C# static "this" -
is there way in c# static method refer type method defined in?
in instance method can determine type by:
public void foo() { type type = this.gettype(); }
how in static method?
public static void bar() { type type = ....? }
update: sorry, clarification needed: know typeof(...)
feature. i'm looking keyword or code gives me type without explicitly referencing class name.
update: besides developer art's answer, looking for, there simpler way?
here go:
public static void bar() { type type = system.reflection.methodbase.getcurrentmethod().declaringtype; }
edit: updated correct error - declaringtype property.
Comments
Post a Comment