One of the new features of Visual Studio 11 and the .NET Framework 4.5 are the Caller attributes:
- CallerMemberName: allows you to obtain the method or property name of the caller to the method.
- CallerFilePath: allows you to obtain the full path of the source file that contains the caller. This is the file path at compile time.
- CallerLineNumber: allows you to obtain the line number in the source file at which the method is called.
These attributes help to simplify the code in certain scenarios, such as logging or when using the INotifyPropertyChanged interface (as in MVVM) and you need to pass the name of the calling property.
[Read More]