GetType within shared method

  • Thread starter Thread starter Nick Pateman
  • Start date Start date
N

Nick Pateman

Hi there,

I'm trying to find the quickest way to get a type object of the current
class within any part of the class. For example,

Me.GetType < This works fine within an instance method but not in a
shared method

GetType(<nameoftype>) < This works fine but defeats the object

Any idea on how I can find it dynamically without having to write the
name of the type myself?

Cheers in advance.

Nick.
 
Nick Pateman said:
I'm trying to find the quickest way to get a type object of the current
class within any part of the class. For example,

Me.GetType < This works fine within an instance method but not in a
shared method

GetType(<nameoftype>) < This works fine but defeats the object

Any idea on how I can find it dynamically without having to write the
name of the type myself?

Try 'MethodBase.GetCurrentMethod().DeclaringType'.
 
Any idea on how I can find it dynamically without having to write the
name of the type myself?

MethodBase.GetCurrentMethod().DeclaringType


Mattias
 
Back
Top