本文整理汇总了C#中Sprocket.Web.CMS.Script.ExecutionState.GetVariable方法的典型用法代码示例。如果您正苦于以下问题:C# ExecutionState.GetVariable方法的具体用法?C# ExecutionState.GetVariable怎么用?C# ExecutionState.GetVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprocket.Web.CMS.Script.ExecutionState
的用法示例。
在下文中一共展示了ExecutionState.GetVariable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Evaluate
public object Evaluate(Token contextToken, List<ExpressionArgument> args, ExecutionState state)
{
object o = state.HasVariable(variableToken.Value) ? state.GetVariable(variableToken.Value) : null;
if (o is IArgumentListEvaluatorExpression)
return ((IArgumentListEvaluatorExpression)o).Evaluate(contextToken, args, state);
else
return SystemTypeEvaluator.EvaluateArguments(state, o, args, contextToken);
}
示例2: EvaluateProperty
public object EvaluateProperty(string propertyName, Token token, ExecutionState state)
{
object o = state.HasVariable(variableToken.Value) ? state.GetVariable(variableToken.Value) : null;
if (o is IPropertyEvaluatorExpression)
{
object val = ((IPropertyEvaluatorExpression)o).EvaluateProperty(propertyName, token, state);
if(val != null)
if (val.ToString() == VariableExpression.InvalidProperty)
throw new InstructionExecutionException("\"" + propertyName + "\" is not a valid property of this variable.", token);
return val;
}
else
return SystemTypeEvaluator.EvaluateProperty(o, propertyName, token);
}