当前位置: 首页>>代码示例>>C#>>正文


C# Expression.GetPropertyName方法代码示例

本文整理汇总了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;
        }
开发者ID:WELL-E,项目名称:VirtualCollection,代码行数:12,代码来源:CommandHolder.cs

示例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);
             };
         }
     }
 }
开发者ID:felixthehat,项目名称:Limo,代码行数:22,代码来源:DelegateCommand.cs

示例3: SaberArgumentException

 internal SaberArgumentException(Expression<Func<object>> expression)
     : base("A faulty argument was passed to the Saber Framework.", new ArgumentException(expression.GetPropertyName()))
 {
 }
开发者ID:StevenThuriot,项目名称:Saber,代码行数:4,代码来源:SaberArgumentException.cs

示例4: RequiredProperty

 public RequiredProperty(ValidationHandler validationHandler, Expression<Func<object>> expression)
 {
     _validationHandler = validationHandler;
     _expression = expression.Compile();
     _propertyName = expression.GetPropertyName();
 }
开发者ID:felixthehat,项目名称:Limo,代码行数:6,代码来源:Validators.cs

示例5: SaveState

 public void SaveState(Expression<Func<object>> property, object value)
 {
     SaveState(property.GetPropertyName(), value);
 }
开发者ID:dotcypress,项目名称:Vermeil,代码行数:4,代码来源:StateManager.cs

示例6: LoadState

 public object LoadState(Expression<Func<object>> property, object defaultValue = null)
 {
     var key = property.GetPropertyName();
     return LoadState(key, defaultValue);
 }
开发者ID:dotcypress,项目名称:Vermeil,代码行数:5,代码来源:StateManager.cs

示例7: Clear

 public void Clear(Expression<Func<object>> property)
 {
     var key = property.GetPropertyName();
     Clear(key);
 }
开发者ID:dotcypress,项目名称:Vermeil,代码行数:5,代码来源:StateManager.cs

示例8: OnPropertyChanged

 private void OnPropertyChanged(Expression<Func<RecipeViewModelState, object>> expression)
 {
     PropertyChanged(this, new PropertyChangedEventArgs(expression.GetPropertyName()));
 }
开发者ID:gnschenker,项目名称:RecipesWithCqrsAndEs,代码行数:4,代码来源:RecipeViewModelState.cs


注:本文中的System.Linq.Expressions.Expression.GetPropertyName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。