Home All Groups Group Topic Archive Search About

How to get the default namespace at runtime ?

Author
12 Apr 2007 9:00 AM
Sharon
How can I get the default namespace of my executable assembly at runtime?

--
Thanks
Sharon

Author
12 Apr 2007 10:36 AM
Alberto Poblacion
"Sharon" <SharonG@newsgroups.nospam> wrote in message
news:92A905A4-153E-4E42-B4FA-F7CC407A412C@microsoft.com...
> How can I get the default namespace of my executable assembly at runtime?

   An assembly does not have a default namespace. It can contain several
classes in several namespaces, and none of them is "default".
   When you are programming in Visual Studio, the project has a "default
namespace" which determines the namespace that will be written into the
source code when you add a new class to the project. As far as I know, this
"default" of the project does not get compiled into the assembly. If you do
not change any of the properties of the project in Visual Studio, this
default namespace happens to be the same as the name of the assembly. You
could get that at runtime through Assembly.GetExecutingAssembly().

Bookmark and Share