TypeBuilder.DefineMethodCore 方法

定义

在派生类中重写时,将具有指定名称、方法属性、调用约定、方法签名和自定义修饰符的新方法添加到类型。

protected:
 abstract System::Reflection::Emit::MethodBuilder ^ DefineMethodCore(System::String ^ name, System::Reflection::MethodAttributes attributes, System::Reflection::CallingConventions callingConvention, Type ^ returnType, cli::array <Type ^> ^ returnTypeRequiredCustomModifiers, cli::array <Type ^> ^ returnTypeOptionalCustomModifiers, cli::array <Type ^> ^ parameterTypes, cli::array <cli::array <Type ^> ^> ^ parameterTypeRequiredCustomModifiers, cli::array <cli::array <Type ^> ^> ^ parameterTypeOptionalCustomModifiers);
protected abstract System.Reflection.Emit.MethodBuilder DefineMethodCore (string name, System.Reflection.MethodAttributes attributes, System.Reflection.CallingConventions callingConvention, Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers, Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers);
abstract member DefineMethodCore : string * System.Reflection.MethodAttributes * System.Reflection.CallingConventions * Type * Type[] * Type[] * Type[] * Type[][] * Type[][] -> System.Reflection.Emit.MethodBuilder
Protected MustOverride Function DefineMethodCore (name As String, attributes As MethodAttributes, callingConvention As CallingConventions, returnType As Type, returnTypeRequiredCustomModifiers As Type(), returnTypeOptionalCustomModifiers As Type(), parameterTypes As Type(), parameterTypeRequiredCustomModifiers As Type()(), parameterTypeOptionalCustomModifiers As Type()()) As MethodBuilder

参数

name
String

方法的名称。 name 不能包含嵌入的 null。

attributes
MethodAttributes

枚举值的按位组合,指定方法的属性。

callingConvention
CallingConventions

方法的调用约定。

returnType
Type

方法的返回类型。

returnTypeRequiredCustomModifiers
Type[]

表示所需自定义修饰符的类型数组。

returnTypeOptionalCustomModifiers
Type[]

表示可选自定义修饰符的类型数组。

parameterTypes
Type[]

方法参数的类型。

parameterTypeRequiredCustomModifiers
Type[][]

由类型数组组成的数组。 每个类型的数组都表示相应参数所需的自定义修饰符。

parameterTypeOptionalCustomModifiers
Type[][]

由类型数组组成的数组。 每个类型数组均表示相应参数的可选自定义修饰符。

返回

一个表示新添加方法的 MethodBuilder 对象。

适用于