It is a Resharper attribute from their Annotations – designed to give you warning then your code looks suspicious 🙂
Consider this:
public class Foo : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void NotifyChanged(string propertyName) { ... }
private string _name;
public string Name {
get { return _name; }
set {
_name = value;
NotifyChanged("LastName");//<-- warning here
}
}
}
With the [NotifyPropertyChangedInvocator]
attribute on the NotifyChanged
method Resharper will give you a warning, that you are invoking the method with a (presumably) wrong value.
Because Resharper now knows that method should be called to make change notification, it will help you convert normal properties into properties with change notification:
Converting it into this:
public string Name
{
get { return _name; }
set
{
if (value == _name) return;
_name = value;
NotifyChange("Name");
}
}
This example is from the documentation on the [NotifyPropertyChangedInvocator]
attribute found here: