About namespace

Hi, I am new to C#.

To create a new namespace, do we need to click any thing on the visual studio 2005 toolbar, or just simple rename the existing namespace to
namespace newname{


this is due to when I simple put a new name, it shows me "Options to update references to rename object".
What happen? What is the correct procedure to put a new namespace?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

just rename it :)
william007Author Commented:
May I know rename what? I wish to create many namespaces...how to do that?
yeah.... bcoz the name space you are going to change is being used in other socurce code files... so it need to update all the reference in other code like
namespace myspace
 class  A  
  public int a ;
  // some code here
in other code file
myspace.A obj ;
A.i = 3 ;
some thing like dat
so it needs to update namespace references. as well.
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

william007Author Commented:
I see, so when I add a new namespace, in the solution explorer, will it show the namespace information? If no, where can we find it?
(Actually I just want to have a high level view of each file contain what namespace, instead of one my one open them)
well... i dont have VS now .. but i guess...

i think Class view explorer ll show you namespaces..

if the changed namespace is being used by any other sourcecode file then it ll show update option,else you can simply change..no update required.
When you type "using System.Drawing" etc. System.Drawing is a namespace. When you write you're own namespace it is possible (and if you are working with a form, almost certain behind the scenes) that another file has got "using YourNamespaceHere" in it (or in the case of WinForms, the generated file needs to be in the same namespace) so it gives you the option to change those accordingly.

If you are changing the namespace of the main file you probably want to go into the project's Properties and change the default namespace accordingly, though I think the "Options to update references to rename object" might do this for you, not sure.

Other than that you can rename the namespace to what you want and just select to update other references usually.

As for information about a namespace, you want the Object Browser (it's under View->Other Windows in VS2005/8 Express and View in Standard and above)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Usually, the namespace corresponds to the assembly name. So if you add a new project to your solution, you are creating a new assembly, and with it a new namespace.

For readibility of your namespaces I usually use the dot notation.  So in my solution I have say 4 assemblies with namespaces like this

Solution is called MobileCentaur

Then namespaces in assemblies


Etc  That way your object relationships become clearer
william007Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.