System.Runtime.Serialization.CodeGenerator.BeginMethod C# (CSharp) Method

BeginMethod() private method

private BeginMethod ( DynamicMethod dynamicMethod, Type delegateType, string methodName, Type argTypes, bool allowPrivateMemberAccess ) : void
dynamicMethod System.Reflection.Emit.DynamicMethod
delegateType System.Type
methodName string
argTypes System.Type
allowPrivateMemberAccess bool
return void
        internal void BeginMethod(DynamicMethod dynamicMethod, Type delegateType, string methodName, Type[] argTypes, bool allowPrivateMemberAccess)
        {
            _dynamicMethod = dynamicMethod;
            _ilGen = _dynamicMethod.GetILGenerator();
            _delegateType = delegateType;

            InitILGeneration(methodName, argTypes);
        }
#endif

Same methods

CodeGenerator::BeginMethod ( Type returnType, string methodName, Type argTypes, bool allowPrivateMemberAccess ) : void
CodeGenerator::BeginMethod ( string methodName, Type delegateType, bool allowPrivateMemberAccess ) : void

Usage Example

コード例 #1
0
            private CodeGenerator GenerateCollectionReaderHelper(CollectionDataContract collectionContract, bool isGetOnlyCollection)
            {
                _ilg = new CodeGenerator();
                bool memberAccessFlag = collectionContract.RequiresMemberAccessForRead(null);

                try
                {
                    if (isGetOnlyCollection)
                    {
                        _ilg.BeginMethod("Read" + collectionContract.StableName.Name + "FromXml" + "IsGetOnly", Globals.TypeOfXmlFormatGetOnlyCollectionReaderDelegate, memberAccessFlag);
                    }
                    else
                    {
                        _ilg.BeginMethod("Read" + collectionContract.StableName.Name + "FromXml" + string.Empty, Globals.TypeOfXmlFormatCollectionReaderDelegate, memberAccessFlag);
                    }
                }
                catch (SecurityException securityException)
                {
                    if (memberAccessFlag)
                    {
                        collectionContract.RequiresMemberAccessForRead(securityException);
                    }
                    else
                    {
                        throw;
                    }
                }
                InitArgs();
                _collectionContractArg = _ilg.GetArg(4);
                return(_ilg);
            }
All Usage Examples Of System.Runtime.Serialization.CodeGenerator::BeginMethod