本文整理汇总了C#中System.Reflection.Emit.OpCode.ToCecil方法的典型用法代码示例。如果您正苦于以下问题:C# OpCode.ToCecil方法的具体用法?C# OpCode.ToCecil怎么用?C# OpCode.ToCecil使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.Emit.OpCode
的用法示例。
在下文中一共展示了OpCode.ToCecil方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnEmit
protected override void OnEmit(OpCode opcode, Label arg)
{
var value = (int)typeof(Label)
.GetFields(BindingFlags.Instance | BindingFlags.NonPublic)
.First()
.GetValue(arg);
ProcessInstruction(
_ilProcessorField.Create(
opcode.ToCecil(),
_labelsField[value].LabeledInstruction
));
}
示例2: OnEmit
protected override void OnEmit(OpCode opcode)
{
ProcessInstruction(ilProcessorField.Create(opcode.ToCecil()));
}
示例3: OnEmit
protected override void OnEmit(OpCode opcode, Type arg)
{
var ts = _assemblyDefinitionField.MainModule.TypeSystem;
TypeReference reference;
if (arg == typeof (bool))
reference = ts.Boolean;
else if (arg == typeof(byte))
reference = ts.Byte;
else if (arg == typeof(sbyte))
reference = ts.SByte;
else if (arg == typeof(short))
reference = ts.Int16;
else if (arg == typeof(ushort))
reference = ts.UInt16;
else if (arg == typeof(int))
reference = ts.Int32;
else if (arg == typeof(uint))
reference = ts.UInt32;
else if (arg == typeof(long))
reference = ts.Int64;
else if (arg == typeof(ulong))
reference = ts.Int64;
else if (arg == typeof(float))
reference = ts.Single;
else if (arg == typeof(double))
reference = ts.Double;
else if (arg == typeof(string))
reference = ts.String;
else if (arg == typeof(void))
reference = ts.Void;
else if (arg == typeof(object))
reference = ts.Object;
else
reference = _assemblyDefinitionField.MainModule.Import(arg);
ProcessInstruction(_ilProcessorField.Create(opcode.ToCecil(), reference));
}