Jump to content
xisto Community
Sign in to follow this  
tinoymalayil

What Is Namespace Using In C#?

Recommended Posts

Hi,What is actually namespace in C#?..is it similar to packages in java used to group a set of classes.or is it using to avoid conflict in giving names to classes?.Can anyone give a suitable answer to this?

Share this post


Link to post
Share on other sites

Namespace is the collection of classes that we use in the application. one namespace having more than 1 classessystem is the root namespace for all the application in c#.for e.g system.FileIO this namespace is content streamreader & streamwriter classes that we use to reading & writing oparation of file in the application.

Share this post


Link to post
Share on other sites

Hi!Namespaces in .NET are analogous to packages in Java. They enable you to create classes with names that are similar and help in avoiding naming conflicts. They also help in maintaining consistency between class names. The concept of namespaces was probably borrowed from C++ and Java, so it isn't unique to the .NET platform.For example, the class OracleConnection is present within Oracle.DataAccess.Client, from the ODP.NET library provided by Oracle, as well as System.Data.OracleClient, the Oracle database access client library provided by Microsoft. By usin the appropriate namespace, such as by importing only one of the two namespaces or by using the fully-qualified name of the class, you can easily switch between the two classes.

Share this post


Link to post
Share on other sites

Namespaces are the way to organize .NET Framework Class Library into a logical grouping according to their functionality, usability as well as category they should belong to, or we can say Namespaces are logical grouping of types for the purpose of identification.

The .NET Framework Class Library (FCL ) is a large collection of thousands of Classes. These Classes are organized in a hierarchical tree.

Robert

Share this post


Link to post
Share on other sites

Namespaces are basically used to organize your code. Its main goal is to create a hierarchical organization of the program and it also assists in avoiding the name clashes between the different sets of code.In .net, all programs are created with default namespace which is global namespace. A program can have any number of namespaces but each namespace should have a unique name.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.