Is there a way in a C# static method to refer to the Type the method is defined in?
In an instance method you can determine the type by:
public void Foo()
{
Type type = this.GetType();
}
how would it look like in a static method?
public static void Bar()
{
Type type = ....?
}
Update: Sorry, clarification needed: I know the typeof(...)
feature. I'm looking for a keyword or code that gives me the Type without explicitly referencing the class name.
Update: Besides Developer Art's answer, which does exactly what I was looking for, is there a simpler way?