views:

95

answers:

1

Is there any way to get the equivalent of GetType within a static constructor?

I want to iterate through the available properties of the type within the static constructor but GetType is an instance method? Why is this? The typeinfo should exist in the static context. Is there a way around this??

~ Cameron

A: 

Just use

Type type = typeof(TheCurrentType);

It should never be more complex than this since you always know the actual type; there's no polymorphism to deal with in static methods.

Rex M