コード例 #1
0
        internal void BeginMethod(Type returnType, MethodBuilderInfo methodBuilderInfo, Type[] argTypes, string[] argNames, MethodAttributes methodAttributes) {
#if DEBUG
            methodBuilderInfo.Validate(returnType, argTypes, methodAttributes);
#endif
            this.methodBuilder = methodBuilderInfo.MethodBuilder;
            this.ilGen = methodBuilder.GetILGenerator();
            InitILGeneration(argTypes, argNames, (methodBuilder.Attributes & MethodAttributes.Static) == MethodAttributes.Static);
        }
コード例 #2
0
        internal MethodBuilder EnsureMethodBuilder(TypeBuilder typeBuilder, string methodName,
            MethodAttributes attributes, Type returnType, Type[] parameterTypes) {
            MethodBuilderInfo methodBuilderInfo;
            if (!methodBuilders.TryGetValue(methodName, out methodBuilderInfo)) {
                MethodBuilder methodBuilder = typeBuilder.DefineMethod(
                    methodName,
                    attributes,
                    returnType,
                    parameterTypes);
                methodBuilderInfo = new MethodBuilderInfo(methodBuilder, parameterTypes);
                methodBuilders.Add(methodName, methodBuilderInfo);
            }
#if DEBUG
            else {
                methodBuilderInfo.Validate(returnType, parameterTypes, attributes);

            }
#endif
            return methodBuilderInfo.MethodBuilder;
        }