Wednesday, October 12, 2011

Get caller's type

If I write a method in C#, can I get to know what type invoked this method? It seems we can, by inspecting the stack trace. But, a better design is just to accept a System.Type parameter and have the caller send that information.

Reference:
http://stackoverflow.com/questions/266115/pass-an-instantiated-system-type-as-a-type-parameter-for-a-generic-class

No comments:

Post a Comment