System.Reflection.Emit.ModuleBuilder.DefineGlobalMethod Method

Defines a global method with the specified name, attributes, calling convention, return type, custom modifiers for the return type, parameter types, and custom modifiers for the parameter types.

Syntax

public MethodBuilder DefineGlobalMethod (string name, System.Reflection.MethodAttributes attributes, System.Reflection.CallingConventions callingConvention, Type returnType, Type[] requiredReturnTypeCustomModifiers, Type[] optionalReturnTypeCustomModifiers, Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers)

Parameters

name
The name of the method. name cannot contain embedded null characters.
attributes
The attributes of the method. attributes must include System.Reflection.MethodAttributes.Static.
callingConvention
The calling convention for the method.
returnType
The return type of the method.
requiredReturnTypeCustomModifiers
An array of types representing the required custom modifiers for the return type, such as System.Runtime.CompilerServices.IsConst or System.Runtime.CompilerServices.IsBoxed. If the return type has no required custom modifiers, specify null.
optionalReturnTypeCustomModifiers
An array of types representing the optional custom modifiers for the return type, such as System.Runtime.CompilerServices.IsConst or System.Runtime.CompilerServices.IsBoxed. If the return type has no optional custom modifiers, specify null.
parameterTypes
The types of the method's parameters.
requiredParameterTypeCustomModifiers
An array of arrays of types. Each array of types represents the required custom modifiers for the corresponding parameter of the global method. If a particular argument has no required custom modifiers, specify null instead of an array of types. If the global method has no arguments, or if none of the arguments have required custom modifiers, specify null instead of an array of arrays.
optionalParameterTypeCustomModifiers
An array of arrays of types. Each array of types represents the optional custom modifiers for the corresponding parameter. If a particular argument has no optional custom modifiers, specify null instead of an array of types. If the global method has no arguments, or if none of the arguments have optional custom modifiers, specify null instead of an array of arrays.

Returns

The defined global method.

Remarks

This overload is provided for designers of managed compilers.

You cannot use the global method that this method defines until you call ModuleBuilder.CreateGlobalFunctions.

Note:

Starting with the net_v20sp1_long, this member no longer requires System.Security.Permissions.ReflectionPermission with the System.Security.Permissions.ReflectionPermissionFlag.ReflectionEmit flag. (See Security Issues in Reflection Emit.) To use this functionality, your application should target the net_v35_long or later.

Requirements

Namespace: System.Reflection.Emit
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0