System.Reflection.Emit.TypeBuilder.DefineTypeInitializer C# (CSharp) Method

DefineTypeInitializer() public method

public DefineTypeInitializer ( ) : System.Reflection.Emit.ConstructorBuilder
return System.Reflection.Emit.ConstructorBuilder
        public System.Reflection.Emit.ConstructorBuilder DefineTypeInitializer() { throw null; }
        public System.Reflection.Emit.FieldBuilder DefineUninitializedData(string name, int size, System.Reflection.FieldAttributes attributes) { throw null; }

Usage Example

        protected override void OnPropertyGenerationComplete(TypeDefinition proxyType)
        {
            const string initPropertyWrappersMethodName = "InitPropertyWrappers";

            var initPropertyWrappersMethod = proxyType.DefineMethod(
                initPropertyWrappersMethodName,
                MethodAttributes.Static | MethodAttributes.Private,
                null, Type.EmptyTypes);

            var il = initPropertyWrappersMethod.GetILGenerator();

            this.initPropertyWrapperIlAction.ForEach(m => m(il));
            il.Emit(OpCodes.Ret);

            var cctor = proxyType.DefineTypeInitializer();

            var cctorIl = cctor.GetILGenerator();

            cctorIl.Emit(OpCodes.Call, initPropertyWrappersMethod);
            cctorIl.Emit(OpCodes.Ret);
        }
All Usage Examples Of System.Reflection.Emit.TypeBuilder::DefineTypeInitializer