當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。