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: 271
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.
- 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.
- CallerLineNumberAttribute: With the help of this attribute we can get line number of source file which the method is called.
- CallerMemberNameAttribute: With the help of this attribute we can get the method or property name of the caller.
© ASP.net Weblogs or respective owner