[Conditional( "DEBUG" )]
[DebuggerStepThrough]
public void VerifyPropertyName( string propertyName)
{
// Verify that the property name matches a real,
// public, instance property on this object.
if (TypeDescriptor.GetProperties( this )[propertyName] == null )
{
string msg = "Invalid property name: " + propertyName;
if ( this .ThrowOnInvalidPropertyName)
throw new Exception(msg);
else
Debug.Fail(msg);
}
}
this .OnPropertyChanged(() => this .ShowOverrideButton);
protected void OnPropertyChanged<T>(Expression<Func<T>> property)
{
PropertyChangedEventHandler handler = this .PropertyChanged;
if (handler != null )
{
var expression = property.Body as MemberExpression;
if (expression == null )
{
throw new NotSupportedException( "Invalid expression passed. Only property member should be selected." );
}
handler( this , new PropertyChangedEventArgs(expression.Member.Name));
}
}
* This source code was highlighted with Source Code Highlighter .
Source: https://habr.com/ru/post/103991/