Sets the method signature, including the return type, the parameter types, and the required and optional custom modifiers of the return type and parameter types.
- returnType
- The return type of the method.
- returnTypeRequiredCustomModifiers
- An array of types representing the required custom modifiers, such as System.Runtime.CompilerServices.IsConst, for the return type of the method. If the return type has no required custom modifiers, specify null.
- returnTypeOptionalCustomModifiers
- An array of types representing the optional custom modifiers, such as System.Runtime.CompilerServices.IsConst, for the return type of the method. If the return type has no optional custom modifiers, specify null.
- parameterTypes
- The types of the parameters of the method.
- parameterTypeRequiredCustomModifiers
- An array of arrays of types. Each array of types represents the required custom modifiers for the corresponding parameter, such as System.Runtime.CompilerServices.IsConst. If a particular parameter has no required custom modifiers, specify null instead of an array of types. If none of the parameters have required custom modifiers, specify null instead of an array of arrays.
- parameterTypeOptionalCustomModifiers
- An array of arrays of types. Each array of types represents the optional custom modifiers for the corresponding parameter, such as System.Runtime.CompilerServices.IsConst. If a particular parameter has no optional custom modifiers, specify null instead of an array of types. If none of the parameters have optional custom modifiers, specify null instead of an array of arrays.
If the return type and the number and types of the parameters are known when the method is defined, they can be established using any overload of the erload:System.Reflection.Emit.TypeBuilder.DefineMethod method that accepts an array of parameter types. However, a generic method can have parameters whose types are specified by one or more of its own generic type parameters, which cannot be defined until after the method has been defined. Use this method to set the parameter types in that case.
If neither the return type nor the parameter types have optional or required custom modifiers, such as Microsoft.VisualC.IsConstModifier, you can use the MethodBuilder.SetReturnType(Type) and MethodBuilder.SetParameters(Type[]) methods.
Calling this method replaces the parameters and return type established using the erload:System.Reflection.Emit.TypeBuilder.DefineMethod method.