本文整理汇总了C#中IOperation.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# IOperation.ToString方法的具体用法?C# IOperation.ToString怎么用?C# IOperation.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOperation
的用法示例。
在下文中一共展示了IOperation.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getSizeOfOpcodeArgument
//.........这里部分代码省略.........
case OperationCode.Br_S:
case OperationCode.Brfalse_S:
case OperationCode.Brtrue_S:
case OperationCode.Ldarg_S:
case OperationCode.Ldarga_S:
case OperationCode.Ldc_I4_S:
case OperationCode.Ldloc_S:
case OperationCode.Ldloca_S:
case OperationCode.Leave_S:
case OperationCode.Starg_S:
case OperationCode.Stloc_S:
return 1;
// instructions with 2 byte argument
case OperationCode.Ldarg:
case OperationCode.Ldarga:
case OperationCode.Ldloc:
case OperationCode.Ldloca:
case OperationCode.Starg:
case OperationCode.Stloc:
return 2;
// instructions with 4 byte argument
case OperationCode.Beq:
case OperationCode.Bge:
case OperationCode.Bge_Un:
case OperationCode.Bgt:
case OperationCode.Bgt_Un:
case OperationCode.Ble:
case OperationCode.Ble_Un:
case OperationCode.Blt:
case OperationCode.Blt_Un:
case OperationCode.Bne_Un:
case OperationCode.Box:
case OperationCode.Br:
case OperationCode.Brfalse:
case OperationCode.Brtrue:
case OperationCode.Call:
case OperationCode.Callvirt:
case OperationCode.Castclass:
case OperationCode.Constrained_:
case OperationCode.Cpobj:
case OperationCode.Initobj:
case OperationCode.Isinst:
case OperationCode.Jmp:
case OperationCode.Ldc_I4:
case OperationCode.Ldc_R4:
case OperationCode.Ldelem:
case OperationCode.Ldelema:
case OperationCode.Ldfld:
case OperationCode.Ldflda:
case OperationCode.Ldftn:
case OperationCode.Ldobj:
case OperationCode.Ldsfld:
case OperationCode.Ldsflda:
case OperationCode.Ldstr:
case OperationCode.Ldtoken:
case OperationCode.Ldvirtftn:
case OperationCode.Leave:
case OperationCode.Mkrefany:
case OperationCode.Newarr:
case OperationCode.Newobj:
case OperationCode.Sizeof:
case OperationCode.Stelem:
case OperationCode.Stobj:
case OperationCode.Stfld:
case OperationCode.Stsfld:
case OperationCode.Unbox_Any:
return 4;
// instructions with 8 byte argument
case OperationCode.Ldc_I8:
case OperationCode.Ldc_R8:
return 8;
// switch is a special case with variable byte length
case OperationCode.Switch:
// switch has one argument with 4 bytes which gives the count
// of the jump targets
uint tempSize = 4;
// each jump target offset uses a 4 byte value
tempSize += (uint)((uint[])operation.Value).Count() * 4;
return tempSize;
// argument size unknown
default:
throw new ArgumentException("Do not know how to handle size of " + operation.ToString() + " instruction.");
}
/* TODO
* cases not implemented yet:
calli
ldfsflda
refanyval
unbox
*/
}