When the CallerMemberName attribute is applied to an argument, the calling method/property/etc name will be supplied. This is useful for snippets, and for implementing non-volatile sections of code without needing to fill-in specifics.
Example:
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged([ CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(
No comments:
Post a Comment