C#/.NET Little Wonders: Getting Caller Information

added by BlackRabbitCoder
7/26/2013 3:13:02 AM

4 Kicks, 258 Views

There are times when it is desirable to know who called the method or property you are currently executing. Some applications of this could include logging libraries, or possibly even something more advanced that may server up different objects depending on who called the method. In the past, we mostly relied on the System.Diagnostics namespace and its classes such as StackTrace and StackFrame to see who our caller was, but now in C# 5, we can also get much of this data at compile-time.


7/26/2013 3:13:09 AM
new post