本文整理汇总了C#中System.Linq.Expressions.Expression.GetPropertyName方法的典型用法代码示例。如果您正苦于以下问题:C# Expression.GetPropertyName方法的具体用法?C# Expression.GetPropertyName怎么用?C# Expression.GetPropertyName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Linq.Expressions.Expression
的用法示例。
在下文中一共展示了Expression.GetPropertyName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOrCreateCommand
public ICommand GetOrCreateCommand(Expression<Func<ICommand>> commandPropertyExpression, Action executeAction)
{
var name = commandPropertyExpression.GetPropertyName();
ICommand command;
if (!_commands.TryGetValue(name, out command))
{
command = new ActionCommand(_ => executeAction());
_commands.Add(name, command);
}
return command;
}
示例2: DelegateCommand
public DelegateCommand(Action executeMethod, Expression<Func<bool>> canExecuteMethod=null, object commandSource=null)
{
_executeMethod = executeMethod ?? (() => { });
if (canExecuteMethod == null)
_canExecuteMethod = (() => true);
else
{
var propertyName = canExecuteMethod.GetPropertyName();
_canExecuteMethod = canExecuteMethod.Compile();
var notifier = (commandSource??_canExecuteMethod.Target) as INotifyPropertyChanged;
if(notifier !=null)
{
notifier.PropertyChanged += (o, e) =>
{
if (e.PropertyName == propertyName)
CanExecuteChanged.Raise(this);
};
}
}
}
示例3: SaberArgumentException
internal SaberArgumentException(Expression<Func<object>> expression)
: base("A faulty argument was passed to the Saber Framework.", new ArgumentException(expression.GetPropertyName()))
{
}
示例4: RequiredProperty
public RequiredProperty(ValidationHandler validationHandler, Expression<Func<object>> expression)
{
_validationHandler = validationHandler;
_expression = expression.Compile();
_propertyName = expression.GetPropertyName();
}
示例5: SaveState
public void SaveState(Expression<Func<object>> property, object value)
{
SaveState(property.GetPropertyName(), value);
}
示例6: LoadState
public object LoadState(Expression<Func<object>> property, object defaultValue = null)
{
var key = property.GetPropertyName();
return LoadState(key, defaultValue);
}
示例7: Clear
public void Clear(Expression<Func<object>> property)
{
var key = property.GetPropertyName();
Clear(key);
}
示例8: OnPropertyChanged
private void OnPropertyChanged(Expression<Func<RecipeViewModelState, object>> expression)
{
PropertyChanged(this, new PropertyChangedEventArgs(expression.GetPropertyName()));
}