namespace MyNamespace
{
class MyClass { }
interface MyInterface { }
struct MyStruct { }
enum Days { a, b }
delegate void MyDelegate();
namespace MyNamespace.NestedNamespace
{
class Employee { }
}
}
using System;
namespace ConsoleApplication1
{
namespace firstNamespace
{
class TutorialRide
{
int count = 1;
public TutorialRide()
{
count++;
}
public void show()
{
Console.WriteLine("I am in First Namespace and count = " + count);
}
}
}
namespace secondNamespace
{
class TutorialRide
{
int count = 2;
public TutorialRide()
{
count++;
}
public void show()
{
Console.WriteLine("I am in Second Namespace and count = " + count);
}
}
}
class Program
{
static void Main(string[] args)
{
firstNamespace.TutorialRide obj1 = new firstNamespace.TutorialRide();
secondNamespace.TutorialRide obj2 = new secondNamespace.TutorialRide();
obj1.show();
obj2.show();
Console.ReadLine();
}
}
}
namespace firstNamespace
{
// Your code declarations.
namespace secondNamespace
{
// Your code declarations.
}
}
using System;
namespace firstNamespace
{
class A
{
public void show()
{
Console.WriteLine("Inside first namespace");
}
}
namespace secondNamespace
{
class B
{
public void show()
{
Console.WriteLine("Inside second namespace");
}
}
}
}
class Program
{
static void Main(string[] args)
{
firstNamespace.A objA = new firstNamespace.A();
firstNamespace.secondNamespace.B objB = new firstNamespace.secondNamespace.B();
objA.show();
objB.show();
Console.ReadLine();
}
}
using System;
using A.B.C;
namespace A
{
namespace B
{
namespace C
{
public class Demo1
{
public void function1()
{
Console.WriteLine("Function1 in namespace A.B.C ");
}
}
}
}
}
namespace D
{
public class Demo2
{
public void function2()
{
Console.WriteLine("Function2 in namespace D ");
}
}
}
namespace E
{
public class Demo3
{
public void function3()
{
Console.WriteLine("Function3 in namespace E ");
}
}
}
namespace F
{
using D;
class Program
{
static void Main(string[] args)
{
// Can access CClass type directly from A.B.C.
Demo1 objDemo1 = new Demo1();
Demo2 objDemo2 = new Demo2();
E.Demo3 objDemo3 = new E.Demo3();
objDemo1.function1();
objDemo2.function2();
objDemo3.function3();
Console.ReadLine();
}
}
}