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

BeginMethod() private method

private BeginMethod ( string methodName, Type delegateType, bool allowPrivateMemberAccess ) : void
methodName string
delegateType System.Type
allowPrivateMemberAccess bool
return void
        internal void BeginMethod(string methodName, Type delegateType, bool allowPrivateMemberAccess)
        {
            MethodInfo signature = delegateType.GetMethod("Invoke");
            ParameterInfo[] parameters = signature.GetParameters();
            Type[] paramTypes = new Type[parameters.Length];
            for (int i = 0; i < parameters.Length; i++)
                paramTypes[i] = parameters[i].ParameterType;
            BeginMethod(signature.ReturnType, methodName, paramTypes, allowPrivateMemberAccess);
            _delegateType = delegateType;
        }

Same methods

CodeGenerator::BeginMethod ( DynamicMethod dynamicMethod, Type delegateType, string methodName, Type argTypes, bool allowPrivateMemberAccess ) : void
CodeGenerator::BeginMethod ( Type returnType, string methodName, Type argTypes, 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