本文整理汇总了C#中Engine.DefineVariable方法的典型用法代码示例。如果您正苦于以下问题:C# Engine.DefineVariable方法的具体用法?C# Engine.DefineVariable怎么用?C# Engine.DefineVariable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine
的用法示例。
在下文中一共展示了Engine.DefineVariable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnExecute
protected override void OnExecute(Engine engine)
{
var value = Value != null ? Value.Get(engine) : null;
if (engine.ScriptDepth == 1)
engine.DefineVariableInParentScope(VariableName, value);
else
engine.DefineVariable(VariableName, value);
}
示例2: OnExecuteFrame
protected override void OnExecuteFrame(Engine engine)
{
engine.SetBreakFrame();
foreach (var item in Collection.Get(engine) as IEnumerable)
{
engine.DefineVariable(VariableName, item);
Body.Execute(engine);
engine.ClearShouldContinue();
if (engine.ShouldInterrupt) break;
}
}
示例3: OnExecute
protected override void OnExecute(Engine engine)
{
var type = engine.GetType(TypeProperty, TypePath, TypeCodeTree);
var value = engine.Get(ValueProperty, Path, CodeTree) as IEnumerable;
var name = engine.GetVariable(Var, VarCodeTree);
foreach (object item in value)
{
engine.DefineVariable(name, TypeHelper.Convert(item, type));
Body.Execute(engine);
engine.ClearShouldContinue();
if (engine.ShouldInterrupt) break;
}
}
示例4: SetLoopValue
private void SetLoopValue(string name, object value, Type type, Engine engine)
{
engine.DefineVariable(name, TypeHelper.Convert(value, type));
}
示例5: OnExecuteFrame
protected override void OnExecuteFrame(Engine engine)
{
engine.DefineVariable(Engine.ContextKey, Context.Get(engine));
Body.Execute(engine);
}