NotifyPropertyChangedInvocatorAttribute - класс

Indicates that the method is contained in a type that implements INotifyPropertyChanged interface and this method is used to notify that some property value changed.

Definition

Пространство имён: Tessa.Properties.Resharper
Сборка: Tessa (в Tessa.dll) Версия: 4.0.4
C#
[AttributeUsageAttribute(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute
Inheritance
Object    Attribute    NotifyPropertyChangedInvocatorAttribute

Заметки

The method should be non-static and conform to one of the supported signatures:
  • NotifyChanged(string)
  • NotifyChanged(params string[])
  • NotifyChanged{T}(Expression{Func{T}})
  • NotifyChanged{T,U}(Expression{Func{T,U}})
  • SetProperty{T}(ref T, T, string)

Пример

C#
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
    }
  }
}
Examples of generated notifications:
  • NotifyChanged("Property")
  • NotifyChanged(() => Property)
  • NotifyChanged((VM x) => x.Property)
  • SetProperty(ref myField, value, "Property")

Конструкторы

NotifyPropertyChangedInvocatorAttribute Initializes a new instance of the NotifyPropertyChangedInvocatorAttribute class.
NotifyPropertyChangedInvocatorAttribute(String) Initializes a new instance of the NotifyPropertyChangedInvocatorAttribute class.

Свойства

ParameterName Gets the parameter name.
TypeIdWhen implemented in a derived class, gets a unique identifier for this Attribute.
(Унаследован от Attribute)

Методы

EqualsReturns a value that indicates whether this instance is equal to a specified object.
(Унаследован от Attribute)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Унаследован от Object)
GetHashCodeReturns the hash code for this instance.
(Унаследован от Attribute)
GetTypeGets the Type of the current instance.
(Унаследован от Object)
IsDefaultAttributeWhen overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.
(Унаследован от Attribute)
MatchWhen overridden in a derived class, returns a value that indicates whether this instance equals a specified object.
(Унаследован от Attribute)
MemberwiseCloneCreates a shallow copy of the current Object.
(Унаследован от Object)
ToStringReturns a string that represents the current object.
(Унаследован от Object)

Методы расширения

Get
(Определяется ComHelper)
Invoke
(Определяется ComHelper)
Set
(Определяется ComHelper)

См. также