public static Create ( Mono.Cecil.Cil.OpCode opcode, int value ) : |
||
opcode | Mono.Cecil.Cil.OpCode | |
value | int | |
Результат |
public static Instruction Create(OpCode opcode, int value)
{
if (opcode.OperandType != OperandType.InlineI)
throw new ArgumentException ("opcode");
return new Instruction (opcode, value);
}
Instruction::Create ( Mono.Cecil.Cil.OpCode opcode ) : |
|
Instruction::Create ( Mono.Cecil.Cil.OpCode opcode, CallSite site ) : |
|
Instruction::Create ( Mono.Cecil.Cil.OpCode opcode, FieldReference field ) : |
|
Instruction::Create ( Mono.Cecil.Cil.OpCode opcode, |
|
Instruction::Create ( Mono.Cecil.Cil.OpCode opcode, MethodReference method ) : |
|
Instruction::Create ( Mono.Cecil.Cil.OpCode opcode, ParameterDefinition parameter ) : |
|
Instruction::Create ( Mono.Cecil.Cil.OpCode opcode, TypeReference type ) : |
|
Instruction::Create ( Mono.Cecil.Cil.OpCode opcode, Mono.Cecil.Cil.VariableDefinition variable ) : |
|
Instruction::Create ( Mono.Cecil.Cil.OpCode opcode, byte value ) : |
|
Instruction::Create ( Mono.Cecil.Cil.OpCode opcode, double value ) : |
|
Instruction::Create ( Mono.Cecil.Cil.OpCode opcode, float value ) : |
|
Instruction::Create ( Mono.Cecil.Cil.OpCode opcode, long value ) : |
|
Instruction::Create ( Mono.Cecil.Cil.OpCode opcode, sbyte value ) : |
|
Instruction::Create ( Mono.Cecil.Cil.OpCode opcode, string value ) : |
private void InsertAndBoxConstant(Injector injector, object constant, TypeReference type, TypeReference boxType = null) { if (type.IsType <string>()) { injector.Insert(OpCodes.Ldstr, (string)constant); } else if (type.IsType <int>()) { injector.Insert(OpCodes.Ldc_I4, (int)constant); } else if (type.IsType <long>()) { injector.Insert(OpCodes.Ldc_I8, (long)constant); } else if (type.IsType <double>()) { injector.Insert(OpCodes.Ldc_R8, (double)constant); } else if (type.IsType <float>()) { injector.Insert(OpCodes.Ldc_R4, (float)constant); } else if (type.IsType <short>()) { injector.Insert(OpCodes.Ldc_I4, (short)constant); } else if (type.IsType <byte>()) { injector.Insert(OpCodes.Ldc_I4, (byte)constant); } else if (type.IsType <uint>()) { injector.Insert(OpCodes.Ldc_I4, (int)(uint)constant); } else if (type.IsType <ulong>()) { injector.Insert(OpCodes.Ldc_I8, (long)(ulong)constant); } else if (type.IsType <ushort>()) { injector.Insert(OpCodes.Ldc_I4, (ushort)constant); } else if (type.IsType <sbyte>()) { injector.Insert(OpCodes.Ldc_I4, (sbyte)constant); } if (boxType != null) { injector.Insert(Instruction.Create(OpCodes.Box, boxType)); } Logger.Warning($"Unknown constant type {constant.GetType().FullName}"); }