Caller Info Attributes in C# 5.0

Posted by Jalpesh P. Vadgama on ASP.net Weblogs See other posts from ASP.net Weblogs or by Jalpesh P. Vadgama
Published on Mon, 17 Dec 2012 19:13:34 GMT Indexed on 2012/12/17 23:04 UTC
Read the original article Hit count: 274

Filed under:
|
|

In c# 5.0 Microsoft has introduced a Caller information attribute. It’s a new feature that is introduced in C# 5.0 and very useful if you want to log your code activities. With the help of this you can implement the log functionality very easily. It can help any programmer in tracing, debugging and diagnostic of any application.

With the help of Caller Information we can get following information over there.

  1. CallerFilePathAttribute: With help of  this attribute we can get full path of source file that contains caller. This will be file path from which contains caller at compile time.
  2. CallerLineNumberAttribute:  With the help of this attribute we can get line number of source file which the method is called.
  3. CallerMemberNameAttribute: With the help of this attribute we can get the method or property name of the caller.

Read more

Shout it

© ASP.net Weblogs or respective owner

Related posts about ASP.NET

Related posts about c#