retrieve a namespace

  • Thread starter Thread starter rodchar
  • Start date Start date
R

rodchar

hey all,

is there, by chance, anyway to pass the name of the namespace your in thru a
method?

thanks,
rodchar
 
rodchar said:
hey all,

is there, by chance, anyway to pass the name of the namespace your in thru a
method?

thanks,
rodchar

I believe all you need is:
this.GetType().Namespace

Mike
 
rodchar said:
how about if it is static ("i know i pushing it")


This code appears to work in both static and non-static classes:

StackTrace st = new StackTrace();
string ns = st.GetFrame(0).GetMethod().ReflectedType.Namespace;
 
thanks so much for the help,
rod.

Family Tree Mike said:
This code appears to work in both static and non-static classes:

StackTrace st = new StackTrace();
string ns = st.GetFrame(0).GetMethod().ReflectedType.Namespace;
 
Back
Top