---
title: "Namespace in .net"  
description: "A namespace is a method of organizing a group of assemblies, classes, or types. A namespace acts as a container, like a folder, for classes organized"  
author: "Anonymous User"  
published: 2010-07-27  
updated: 2019-08-10  
canonical: https://www.mindstick.com/articles/28/namespace-in-dot-net  
category: ".net"  
tags: [".net"]  
reading_time: 2 minutes  

---

# Namespace in .net

A namespace is a method of organizing a group of assemblies, classes, or types. A namespace acts as a container, like a folder, for classes organized into groups usually based on functionality.

To access the built-in input-output (I/O) classes and members, use the System.IO namespace. Or, to access Web-related classes and members, use the System.Web namespace. All C# programs should call the System namespace

Using namespace

## Example:

using System;

The using keyword allows us to use the classes of the referred namespace. By using the System namespace we can access all the classes of it.

Keyword ‘using’ only allows accessing the classes in the referred namespace and not its internal or child namespaces. Hence in order to access the classes defined in Data namespace which is a child namespace of System namespace we have to write the following.

using System.Data;

Commonly used namespaces

The following is list of some important and frequently used .NET namespaces:

- System.Collections
- System.Data
- System.Diagnostics
- System.Drawing
- System.IO
- System.Net
- System.Reflection
- System.Runtime
- System.Security
- System.Threading
- System.Web
- System.Windows.Forms
- System.Xml

##### Creating namespace

A namespace can be created via the Namespace keyword.

##### Example

```
namespace Books
{
{
class Authors
{
{
//Do something
}
}
```

This is simple namespace example. We can also build hierarchy of namespace.

Example

```
namespace Books
{
namespace Inventory
{
using System;
class AddInventory
{
public void MyMethod()
{
Console.WriteLine("Adding Inventory via MyMethod!");
}
}
}
}
```

\

---

Original Source: https://www.mindstick.com/articles/28/namespace-in-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
