本文整理汇总了C#中VirtualMachine.getVariable方法的典型用法代码示例。如果您正苦于以下问题:C# VirtualMachine.getVariable方法的具体用法?C# VirtualMachine.getVariable怎么用?C# VirtualMachine.getVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VirtualMachine
的用法示例。
在下文中一共展示了VirtualMachine.getVariable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: execute
public override void execute(VirtualMachine vm, IList<string> parameters)
{
Variable variable1 = vm.getVariable(parameters[1]);
Variable variable2 = vm.getVariable(parameters[2]);
string newValue = (Int32.Parse(variable1.getValue()) + Int32.Parse(variable2.getValue())).ToString();
vm.ReturnVariable.setValue(newValue);
}
示例2: Execute
public override void Execute(VirtualMachine vm, IList<string> parameters)
{
int var1;
int var2;
if (Int32.TryParse(vm.getVariable(parameters[1]), out var1) && Int32.TryParse(vm.getVariable(parameters[2]), out var2))
vm.ReturnValue = Convert.ToString(var1 >= var2);
else
Console.WriteLine("Compile error: Cannot compare strings to be greater or equal");
}
示例3: execute
public override void execute(VirtualMachine vm, IList<string> parameters)
{
Variable variable1 = vm.getVariable(parameters[1]);
Variable variable2 = vm.getVariable(parameters[2]);
int leftHand = Int32.Parse(variable1.getValue());
int rightHand = Int32.Parse(variable2.getValue());
Variable newReturnVariable = vm.ReturnVariable.clone();
newReturnVariable.setValue((leftHand >= rightHand).ToString());
vm.ReturnVariable = newReturnVariable;
}
示例4: execute
public override void execute(VirtualMachine vm, IList<string> parameters)
{
int number;
bool isNumeric = int.TryParse(parameters[1], out number);
if (isNumeric)
Console.WriteLine(number);
else
{
string toPrint = vm.getVariable(parameters[1]).getValue();
Console.WriteLine(toPrint);
}
}
示例5: Execute
public override void Execute(VirtualMachine vm, IList<string> parameters)
{
Console.WriteLine(vm.getVariable(parameters[1]));
}