Google


Earn money without investing 1$

lovebird-mails.com lovebird-mails.com

Wednesday, August 8, 2007

Namespace in c#

Namespace

C# namespace allow us to organize our class.unlike a file and component namespace provide us a flexibility to group our class and other types
For eg
Namespace MyCustomNameSpace
{
using System;
public int show()
{
return 0;
}
}
Using keyword in C#
C# allows us to abbreviate a class full name for doing this we have to list the class namespace at the top of the file with the “Using” key word
Eg
Using MyNameSpace.CsharpExample
Class MyClass
{
public static int Main()
{
SomeOtherNameSpace.SomeOtherClass loMyObj = new SomeOtherNameSpace.SomeOtherClass loMyObj();
Return 0;
}
}
Namespace Aliases
The another use of the namespace in c# is creating aliases.this is use ful when we have a long namespace for eg
Using myAliases = MyNameSpace.CsharpExample;

No comments:

Review Books

  • ASP.NET WebService
  • Learn VisualStudio.net
  • Basic .NET Framework
  • Basic C#
  • .NET Interview Questions
  • C# 2005 Programming