how to get the namespace inside a static method?

  • Thread starter Thread starter Kevin
  • Start date Start date
K

Kevin

Hi there,

I have a class with a static method, how can I find the namespace of the
class from inside the method.

TIA
 
static string GetNamespace(){
return new
System.Diagnostics.StackTrace().GetFrame(0).GetMethod().DeclaringType.Namespace;
}

Try the above

Ciaran O'Donnell
 
^_^

Works great, thanks Ciaran.
static string GetNamespace(){
return new
System.Diagnostics.StackTrace().GetFrame(0).GetMethod().DeclaringType.Namespace;
}

Try the above

Ciaran O'Donnell
 
Back
Top