Thomas Levesque 6/13/2012

Using C# 5 caller info attributes when targeting earlier versions of the .NET framework

Read Original

This technical article details a workaround for using C# 5's caller info attributes (CallerMemberName, CallerFilePath, CallerLineNumber) in projects targeting earlier .NET Framework versions. It demonstrates how to define custom attributes in the System.Runtime.CompilerServices namespace to trick the compiler, enabling this logging and diagnostic feature in .NET 4.0, 3.5, or 2.0.

Using C# 5 caller info attributes when targeting earlier versions of the .NET framework

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser