ISymbolMethod

  • Thread starter Thread starter Richard Ward
  • Start date Start date
R

Richard Ward

Hi

I want to pull the name of the namespace a method is defined in from
inside the method itself. MSDN say to use ISymbolMethod.GetNamespace.
However, how do I get a reference to ISymbolMethod interface.

Anybody got an example?

TIA

Richard
 
Richard Ward said:
I want to pull the name of the namespace a method is defined in from
inside the method itself. MSDN say to use ISymbolMethod.GetNamespace.

Where does it say that?
However, how do I get a reference to ISymbolMethod interface.

Anybody got an example?

I don't think you want ISymbolMethod at all. Just use
MethodBase.GetCurrentMethod().ReflectedType.Namespace

Note the use of ReflectedType rather than DeclaringType - you may want
to experiment to get the exact desired behaviour, depending on
overriding etc.
 
Back
Top