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


C# IExpression.GetValue方法代码示例

本文整理汇总了C#中IExpression.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# IExpression.GetValue方法的具体用法?C# IExpression.GetValue怎么用?C# IExpression.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IExpression的用法示例。


在下文中一共展示了IExpression.GetValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetPropertyValue

 /// <summary>Gets the value of a property.</summary>
 /// <param name="propertyExpression">
 /// The property expression that should be used to retrieve the property value.
 /// </param>
 /// <returns>The value of the property.</returns>
 /// <exception cref="Spring.Objects.FatalObjectException">
 /// If there is no such property, if the property isn't readable, or
 /// if getting the property value throws an exception.
 /// </exception>
 public virtual object GetPropertyValue(IExpression propertyExpression)
 {
     return propertyExpression.GetValue(this.wrappedObject);
 }
开发者ID:fgq841103,项目名称:spring-net,代码行数:13,代码来源:ObjectWrapper.cs

示例2: EvalCondition

 /// <summary>
 /// Evaluates a SpEL expression as a boolean value.
 /// </summary>
 /// <param name="condition">
 /// The expression string that should be evaluated.
 /// </param>
 /// <param name="conditionExpression">
 /// The SpEL expression instance that should be evaluated.
 /// </param>
 /// <param name="context">
 /// The object to evaluate expression against.
 /// </param>
 /// <param name="variables">
 /// The expression variables dictionary.
 /// </param>
 /// <returns>
 /// The evaluated boolean.
 /// </returns>
 /// <exception cref="System.InvalidOperationException">
 /// If the SpEL expression could not be successfuly resolved to a boolean.
 /// </exception>
 protected static bool EvalCondition(string condition, 
     IExpression conditionExpression, object context, IDictionary<string, object> variables)
 {
     if (conditionExpression == null)
     {
         return true;
     }
     else
     {
         object value = conditionExpression.GetValue(context, variables);
         if (value is bool)
         {
             return (bool)value;
         }
         else
         {
             throw new InvalidOperationException(String.Format(
                 "The SpEL expression '{0}' could not be successfuly resolved to a boolean.", 
                 condition));
         }
     }
 }
开发者ID:Binodesk,项目名称:spring-net,代码行数:43,代码来源:BaseCacheAdvice.cs


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