Esempio n. 1
0
        // Finalize this method by writing its code to the output image.
        internal void FinalizeMethod()
        {
            int rva;

            if (bodySet)
            {
                if (explicitBody == null)
                {
                    rva = 0;
                }
                else
                {
                    rva = ILGenerator.WriteExplicitCode
                              (type.module, explicitBody, initLocals);
                }
            }
            else if (ilGenerator != null)
            {
                rva = ilGenerator.WriteCode(initLocals);
            }
            else
            {
                rva = 0;
            }
            lock (typeof(AssemblyBuilder))
            {
                ClrMethodSetRVA(privateData, rva);
            }
        }
Esempio n. 2
0
        // Finalize this constructor by writing its code to the output image.
        internal void FinalizeConstructor()
        {
            int rva;

            if (ilGenerator != null)
            {
                rva = ilGenerator.WriteCode(initLocals);
            }
            else
            {
                rva = 0;
            }
            lock (typeof(AssemblyBuilder))
            {
                MethodBuilder.ClrMethodSetRVA(privateData, rva);
            }
        }
	// Write an explicit method body to the code section and
	// return the RVA that corresponds to it.
	internal static int WriteExplicitCode
				(ModuleBuilder module, byte[] explicitBody, bool initLocals)
			{
				ILGenerator ilgen = new ILGenerator(module, explicitBody);
				return ilgen.WriteCode(initLocals);
			}