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。

備註

當元數據串行化時,會將位移新增至區塊開頭的虛擬位址,以計算元數據中儲存的最終相對虛擬位址。

適用於