Skip to content

Latest commit

 

History

History
33 lines (26 loc) · 1.07 KB

File metadata and controls

33 lines (26 loc) · 1.07 KB

NotifyPropertyChangedExtensions.SetValue<T> method

Sets a value, taking care of the PropertyChangedEventHandler invocation if value did change.

private bool _loading;
public bool Loading
{
   get => _loading;
   private set => this.SetValue(ref _loading, value, RaisePropertyChanged);
}
public static void SetValue<T>(this INotifyPropertyChanged src, ref T field, T value, 
    Action<string> propertyChanged = null, [CallerMemberName] string propertyName = null)
parameter description
T
src Ignored parameter (only used to allow this method to be used as an extension on INotifyPropertyChanged implementers
field Field to set
value Value to set the field to
propertyChanged Handler
propertyName "Injected" target property name (sent to the propertyChanged handler)

See Also