Search Placementyogi.com
 

Namespace in C#

A namespace in C# is the name of a group that contains related types (like classes) in an assembly. These are the predefined classes useful for writing our codes.

Few Important Types (Classes) Defined in .NET Namespace

Here System is a namespace.

  • System.IO
  • System.Data
  • System.Xml
  • System.Web

How to Include a Namespace in C# Program

Simply put the required namespace in the beginning of your C# program by using keyword using as given in following sample program:

using System.IO;
class Yogi
{
	static void Main(string[] args)
        {
		File.Create("File path");
        }
}

If you don't want to include a namespace in the beginning of your program then use the fully qualified name of any type as given in the following program.

class Yogi
{
	static void Main(string[] args)
        {
		System.IO.File.Create("File path");
        }
}

Few Important Points to Remember about Namespace in C#

  1. There is no difference in using fully qualified name or including namespace from the compiler's context.
  2. There is no performance difference in using both.
  3. Only benefit of including namespace is that we avoid few keystrokes.
Banner to LogicGuns.com

Hide Page Information

Namespace Tutorial in C#, Learn basics of Namespace in .NET, Helpful for Technical Interviews

Namespace Tutorial in C#, Learn basics of Namespace in .NET, Helpful for Technical Interviews

Here you can find basic tutorial through easy learning for Namespace

Why Namespace in C#

In this section you can learn about Namespace to improve your skills in order to face the interviews, competitive examinations and various entrance tests with full confidence.

Where can I get Namespace tutorials in .NET?

PlacementYogi provides .NET Framework tutorial with Namespace through easy learning process focusing interviews.

You can easily learn Namespace in .NET through our compact and best tutorials.