예제 #1
0
        internal static Instruction CreateInlineFieldInstruction()
        {
            FieldDefinition field = new FieldDefinition("Test", FieldAttributes.Public,
                                                        CecilUtility.Import(typeof(object)));

            return(Instruction.Create(OpCodes.Ldfld, field));
        }
예제 #2
0
        internal static ParameterDefinition CreateParameterDefinition(int index)
        {
            var method = CecilUtility.Import(ReflectionUtility.GetMethod(() => int.Parse(string.Empty))).Resolve();

            ParameterDefinition parameter = null;

            for (int i = 0; i <= index; ++i)
            {
                parameter = new ParameterDefinition(CecilUtility.Import(typeof(object)));
                method.Parameters.Add(parameter);
            }

            return(parameter);
        }