C# 5 caller info when targeting earlier versions of the .NET Framework

added by tom103
6/14/2012 5:28:27 AM

4 Kicks, 241 Views

C# 5 has a cool new feature named "caller information", that makes it easier to write logging methods. This article explains how to use this feature when targeting earlier versions of the .NET framework (provided that you use the C# 5 compiler of course).


2 comments

dpeterson
6/14/2012 8:25:54 AM
Wow, it never crossed my mind to try and add to one of the .Net framework namespaces, or that the compiler would take heed of these attributes in this case. Really cool hack.

timbolt8
6/18/2012 10:25:43 AM
Neat, I like little blurbs like this. Useful and a sort read!