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

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -