How to get the default namespace at runtime ?

  • Thread starter Thread starter Guest
  • Start date Start date
Sharon said:
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().
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top