语言

MetadataBuilder.AddMethodDefinition 方法

定义

添加方法定义。

public:
 System::Reflection::Metadata::MethodDefinitionHandle AddMethodDefinition(System::Reflection::MethodAttributes attributes, System::Reflection::MethodImplAttributes implAttributes, System::Reflection::Metadata::StringHandle name, System::Reflection::Metadata::BlobHandle signature, int bodyOffset, System::Reflection::Metadata::ParameterHandle parameterList);
public System.Reflection.Metadata.MethodDefinitionHandle AddMethodDefinition(System.Reflection.MethodAttributes attributes, System.Reflection.MethodImplAttributes implAttributes, System.Reflection.Metadata.StringHandle name, System.Reflection.Metadata.BlobHandle signature, int bodyOffset, System.Reflection.Metadata.ParameterHandle parameterList);
member this.AddMethodDefinition : System.Reflection.MethodAttributes * System.Reflection.MethodImplAttributes * System.Reflection.Metadata.StringHandle * System.Reflection.Metadata.BlobHandle * int * System.Reflection.Metadata.ParameterHandle -> System.Reflection.Metadata.MethodDefinitionHandle
Public Function AddMethodDefinition (attributes As MethodAttributes, implAttributes As MethodImplAttributes, name As StringHandle, signature As BlobHandle, bodyOffset As Integer, parameterList As ParameterHandle) As MethodDefinitionHandle

参数

attributes
MethodAttributes

方法属性。

implAttributes
MethodImplAttributes

方法实现属性。

name
StringHandle

方法名称。

signature
BlobHandle

方法签名。

bodyOffset
Int32

PE 映像中存储方法主体(IL 流)的块内的偏移量;如果方法没有主体,则 -1。

parameterList
ParameterHandle

如果方法在 Params 表中声明参数,请将此参数设置为第一个参数的句柄。 否则,请将此项设置为下一个方法定义声明的第一个参数的句柄。 如果未在模块中声明任何参数, System.Reflection.Metadata.Ecma335.MetadataTokens.ParameterHandle(1)则为 .

返回

已添加的方法定义的句柄。

例外

bodyOffset 小于 -1。

注解

当元数据通过向块开头的虚拟地址添加偏移量来序列化元数据时,将计算元数据中存储的最终相对虚拟地址。

适用于