Why namespaces used in C#?

Posted on Updated on

0Namespaces are used to logically group together similar classes that have related functionality. Namespaces can also be used to group similar data types. In .Net Framwork, all the namespaces basically emerge from the common namespace called system. Another most important data type included in this namespace is ‘Object’. The object data type forms the base object which is inherited bt all other .NET objects. Table 1.1 contains a list of the most commonly used second-level namespaces included under the system namespace. A namespace is build by company. It allows us discover and comprehend how a system code platform is organized. Namespaces are not important for C# applications. They are usually used to create system code better.

Namespace Description
System. Drawing Handles the graphics and drawing, including printing
System. Data Handles the data access and management; plays an important rote in defining the ADO .NET technology
System. IO Manages the synchronous and asynchronous access to files and streams
System. Windows Handles the form-based Windows creations.
System. Reflection Contains classes for reading metadata from assemblies
System. Threading Contains classes for multithreaded programming
System. Collections Contains interfaces and classes that define various collection of objects

Table – 1.1


This example has namespaces with the identifiers A, B, C, D, E, and F. Namespaces B and C are stacked within namespace A. Namespaces D, E, and F are all at the top stage of the collection device.

In the Program category, observe how the Primary access factor uses the CClass, DClass, and FClass types. Because the using A.B.C and using D directives are existing in namespace E, the Primary technique can straight use those types.


With FClass, the namespace must be specified clearly because F is not involved within of E with a using instruction.

Example :- C# program that demonstrates namespace use

using System;

using A.B.C;


namespace E


    using D;


    class Program


            static void Main()


                // Can access CClass type directly from A.B.C.

                CClass var1 = new CClass();


                // Can access DClass type from D.

                DClass var2 = new DClass();


                // Must explicitely specify F namespace.

                F.FClass var3 = new F.FClass();


                // Display types.








namespace A


    namespace B


            namespace C


                public class CClass







namespace D


    public class DClass





namespace F


    public class FClass








Allowed namespace kind titles. Moreover to using the regular alphanumeric titles for namespaces, you can consist of the interval separator in a namespace. This is a compacted edition of having stacked namespaces.


Try modifying namespace F into namespace F.F. Then change the Primary technique to have the additional namespace as well.

Here we define the Advantages & Disadvantages of framework :-


Advantages of framework

  1. It reduces the time and energy in developing the software.
  2. It provides the way of working so that the developer has to do only the advanced development and all the basics are provided by the framework.
  3. It gives a design pattern so that the code is clean and can be modified and extended easily.
  4. Business logic is independent from the designing part so that any modification in any one of them does not affect the other one.
  5. The frameworks have high security implementations and as the users are widely spread, any vulnerability to it can be notified to the developers for rectification.
  6. Most of the frameworks are freely available on internet and can be easily downloaded.
  7. It provides a good support to clarify the doubts in the form of forums, documentation and support teams.


  1. It is basically for large applications, small applications are much faster with the custom code rather than using frameworks.
  2. For a newbie, it requires lot of time to understand the things as it is big and complex abstraction of data.
  3. While knowing the framework doesn’t means that one knows the language behind it while knowing a language one can do the coding without the help of framework also .


For more details and queries please feel free to email, visit or call us. Wishing you the very best for all your future endeavors.
Helpline: 9814666333, 8699444666
Email: info@technocampus.co.in

Please fill the form and we shall contact you soon.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s