Well, your program could very well use objects outside of your
namespace. I assume though, that you mean the entry point of your program.
What you want to do is call the static GetEntryAssembly method on the
Assembly class. Once you do that, you will have the assembly that has the
entry point for the application. You should do a check for null, because
this will return null if, for example, the code was invoked through COM
interop.
Once you have the assembly, you can get the MethodInfo of the method
that is the entry point for the assembly (an assembly can have only one
entry point).
With the MethodInfo, you can get its type, and then get the namespace of
the type.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"ad" <fl****@wfes.tcc.edu.tw> wrote in message
news:eS**************@TK2MSFTNGP03.phx.gbl...
Hi,
How can I get the namespace of my program in run time?