Bewerken

Share via


MetadataBuilder.AddMethodDefinition Method

Definition

Adds a method definition.

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

Parameters

attributes
MethodAttributes

The method attributes.

implAttributes
MethodImplAttributes

The method implementation attributes.

name
StringHandle

The method name.

signature
BlobHandle

The method signature.

bodyOffset
Int32

Offset within the block in the PE image that stores method bodies (the IL stream), or -1 if the method doesn't have a body.

parameterList
ParameterHandle

If the method declares parameters in the Params table, set this to the handle of the first one. Otherwise, set this to the handle of the first parameter declared by the next method definition. If no parameters are declared in the module, System.Reflection.Metadata.Ecma335.MetadataTokens.ParameterHandle(1).

Returns

A handle to the added method definition.

Exceptions

bodyOffset is less than -1.

Remarks

The final relative virtual address stored in the metadata is calculated when the metadata is serialized by adding the offset to the virtual address of the beginning of the block.

Applies to