public static void Notify <TMember>( this INotifyPropertyChanged sender, PropertyChangedEventHandler handler, Expression <Func <TMember> > expression) { if (sender == null) { throw new ArgumentNullException("sender"); } if (expression == null) { throw new ArgumentNullException("expression"); } var body = expression.Body as MemberExpression; if (body == null) { throw new ArgumentException("The expression must target a property or field.", "expression"); } string propertyName = PropertyChangedExt.GetPropertyName(body, sender.GetType()); PropertyChangedExt.NotifyCore(sender, handler, propertyName); }
public static void Notify(this INotifyPropertyChanged sender, PropertyChangedEventHandler handler, string propertyName) { if (sender == null) { throw new ArgumentNullException("sender"); } if (propertyName == null) { throw new ArgumentNullException("propertyName"); } ReflectionHelper.ValidatePropertyName(sender, propertyName); PropertyChangedExt.NotifyCore(sender, handler, propertyName); }