CSharp - Namespace using Directive

Introduction

The using directive imports a namespace.

After importing the namespace, you can refer to types without their fully qualified names.

The following imports the Outer.Middle.Inner namespace:


namespace Outer.Middle.Inner
{
       class Class1 {}
       class Class2 {}
}



using Outer.Middle.Inner;

class Test
{
       static void Main()
       {
         Class1 c;    // Don't need fully qualified name
       }
}