Creating an alias : NameSpace : Language Basics C# Source Code


Custom Search

C# Source Code » Language Basics » NameSpace »

 

Creating an alias








    


using System;
using MyAlias=MyNamespace.Nested.MyClass;

namespace MyNamespace {
  namespace Nested {
       namespace MyClass {
             public class Foo
             {
                  int _Value;
                  public Foo() {
                    _Value = 0;
                  }
                  public int getValue()
                  {
                    return _Value;
                  }
             }
       }
  }
}


class Test {
  public static void Main() {
      MyAlias.Foo myFoo = new MyAlias.Foo();
      Console.WriteLine("Value {0}", myFoo.getValue());
  }
}

           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Language Basics
» NameSpace