Computer problems,Computer help
*AX SOFT>>>Programming & Design

[C#] How do I get the name of the current program's namespace as a string?


In C#, how do I get the name of the current program's namespace as a string?

For reference and for those who are confused for why Mohamed.Mansour said, "Okay, now the question is a understandable. :)," here's the link:
http://answers.yahoo.com/question/index;...

Hello,

Okay, now the question is a understandable. :) You have to recall that an application may or may not have an namespace, it is optional, but it is best to use it for organization and many other stuff that I explained in your other post.

Now to get the name of the program's namespace, I would assume your "current program" means the entry point of the program, therefore you will use Reflection to grab the namespace programatically. To do this you will need the following:

Make sure you remove the spaces (Yahoo formats it bad)
==========
string currentNamespace = Assembly . GetEntryAssembly() . GetTypes() [0] . Namespace;
==========

The above will grab the namespace defined in the Assembly. If your application has more than one namespace, then that assembly will be more than one arraysize.

Good Luck

// string //

Tags
  General - Computers & Internet   Software   Security   Programming & Design   Facebook   Flickr   Google   MSN   MySpace
Related information
  • How do you "reinstall" Zwinky?

    i would leave zwinky alone i think it has spyware and all sorts of crap that you dont want

    ...
  • Shall I take C#/C++ or Visual Basic for AVR Programming?

    well since you do assembly then learning any other of the said languages will be easy for you, given your situation I'd say go for C/C++!

    ...
  • Java, nested loop?

    for (int c=1;c<=4;c++) { for (int i=c;i<=4;i++) { System.out.println(i); } }

    ...
  • I need help to create a program to put a string backwards with an array and a function?

    Not sure what language, but in pseudo code.... I assume you have an array that contains Strings. 1) Loop through the array creating a temporary string variable for each word in your array. &...

  • Vista slow boot with black screen?

    mines does the same. nothing wrong with that at least it doesn't have some Major virus!

    ...
  • Is there a visual basic for Mac? Or something Similar?

    i like java. the syntax is similar to visual basic in most respects, and it works on all computers not just ms windows. eclipse is an awesome development platform for java and works great on os...

  • Setting up mysql on godaddy?

    no.. you do not need to download mysql. they have it installed for you. set your database up on their site.

    ...
  • Tell me this?

    I suggest joining the yahoo mailing list over here . ...

  •  

    Categories--Copyright/IP Policy--Contact Webmaster