MetadataBuilder 类

定义

MetadataBuilder 类以高性能的方式读取和写入程序集的元数据。The MetadataBuilder class reads and writes metadata for an assembly in a highly performant manner. 它专用于编译器和其他程序集生成工具。It is designed for use by compilers and other assembly generation tools.

public ref class MetadataBuilder sealed
public sealed class MetadataBuilder
type MetadataBuilder = class
Public NotInheritable Class MetadataBuilder
继承
MetadataBuilder

构造函数

MetadataBuilder(Int32, Int32, Int32, Int32)

创建元数据表和堆的生成器。Creates a builder for metadata tables and heaps.

方法

AddAssembly(StringHandle, Version, StringHandle, BlobHandle, AssemblyFlags, AssemblyHashAlgorithm)
AddAssemblyFile(StringHandle, BlobHandle, Boolean)
AddAssemblyReference(StringHandle, Version, StringHandle, BlobHandle, AssemblyFlags, BlobHandle)
AddConstant(EntityHandle, Object)

添加参数、字段或属性的默认值。Adds a default value for a parameter, field or property.

AddCustomAttribute(EntityHandle, EntityHandle, BlobHandle)

添加自定义属性。Adds a custom attribute.

AddCustomDebugInformation(EntityHandle, GuidHandle, BlobHandle)

添加自定义调试信息。Adds custom debug information.

AddDeclarativeSecurityAttribute(EntityHandle, DeclarativeSecurityAction, BlobHandle)

将声明性安全属性添加到类型、方法或程序集。Adds a declarative security attribute to a type, method, or assembly.

AddDocument(BlobHandle, GuidHandle, BlobHandle, GuidHandle)

添加文档调试信息。Adds document debug information.

AddEncLogEntry(EntityHandle, EditAndContinueOperation)
AddEncMapEntry(EntityHandle)
AddEvent(EventAttributes, StringHandle, EntityHandle)

添加事件定义。Adds an event definition.

AddEventMap(TypeDefinitionHandle, EventDefinitionHandle)
AddExportedType(TypeAttributes, StringHandle, StringHandle, EntityHandle, Int32)

添加导出类型。Adds an exported type.

AddFieldDefinition(FieldAttributes, StringHandle, BlobHandle)

添加字段定义。Adds a field definition.

AddFieldLayout(FieldDefinitionHandle, Int32)

定义字段定义的字段布局。Defines a field layout of a field definition.

AddFieldRelativeVirtualAddress(FieldDefinitionHandle, Int32)

将字段中的映射添加到存储在 PE 映像中的初始值。Adds a mapping from a field to its initial value stored in the PE image.

AddGenericParameter(EntityHandle, GenericParameterAttributes, StringHandle, Int32)

添加泛型参数定义。Adds a generic parameter definition.

AddGenericParameterConstraint(GenericParameterHandle, EntityHandle)

向泛型参数添加类型约束。Adds a type constraint to a generic parameter.

AddImportScope(ImportScopeHandle, BlobHandle)

添加局部作用域调试信息。Adds local scope debug information.

AddInterfaceImplementation(TypeDefinitionHandle, EntityHandle)

将接口实现添加到类型。Adds an interface implementation to a type.

AddLocalConstant(StringHandle, BlobHandle)

添加局部常量调试信息。Adds local constant debug information.

AddLocalScope(MethodDefinitionHandle, ImportScopeHandle, LocalVariableHandle, LocalConstantHandle, Int32, Int32)

添加局部作用域调试信息。Adds local scope debug information.

AddLocalVariable(LocalVariableAttributes, Int32, StringHandle)

添加局部变量调试信息。Adds local variable debug information.

AddManifestResource(ManifestResourceAttributes, StringHandle, EntityHandle, UInt32)

添加清单资源。Adds a manifest resource.

AddMarshallingDescriptor(EntityHandle, BlobHandle)

向字段或参数添加封送信息。Adds marshalling information to a field or a parameter.

AddMemberReference(EntityHandle, StringHandle, BlobHandle)

添加 MemberRef 表行。Adds a MemberRef table row.

AddMethodDebugInformation(DocumentHandle, BlobHandle)

添加方法调试信息。Adds method debug information.

AddMethodDefinition(MethodAttributes, MethodImplAttributes, StringHandle, BlobHandle, Int32, ParameterHandle)

添加方法定义。Adds a method definition.

AddMethodImplementation(TypeDefinitionHandle, EntityHandle, EntityHandle)

定义类型中方法声明的实现。Defines an implementation for a method declaration within a type.

AddMethodImport(MethodDefinitionHandle, MethodImportAttributes, StringHandle, ModuleReferenceHandle)

将导入信息添加到方法定义。Adds import information to a method definition.

AddMethodSemantics(EntityHandle, MethodSemanticsAttributes, MethodDefinitionHandle)

将方法(getter、setter、adder 等)与属性或事件关联。Associates a method (a getter, a setter, an adder, etc.) with a property or an event.

AddMethodSpecification(EntityHandle, BlobHandle)

添加方法规范(实例化)。Adds a method specification (an instantiation).

AddModule(Int32, StringHandle, GuidHandle, GuidHandle, GuidHandle)
AddModuleReference(StringHandle)
AddNestedType(TypeDefinitionHandle, TypeDefinitionHandle)

定义与指定的类型定义的嵌套关系。Defines a nesting relationship to specified type definitions.

AddParameter(ParameterAttributes, StringHandle, Int32)

添加参数定义。Adds a parameter definition.

AddProperty(PropertyAttributes, StringHandle, BlobHandle)

添加属性定义。Adds a property definition.

AddPropertyMap(TypeDefinitionHandle, PropertyDefinitionHandle)
AddStandaloneSignature(BlobHandle)
AddStateMachineMethod(MethodDefinitionHandle, MethodDefinitionHandle)

添加状态机方法调试信息。Adds state machine method debug information.

AddTypeDefinition(TypeAttributes, StringHandle, StringHandle, EntityHandle, FieldDefinitionHandle, MethodDefinitionHandle)

添加类型定义。Adds a type definition.

AddTypeLayout(TypeDefinitionHandle, UInt16, UInt32)

定义类型定义的类型布局。Defines a type layout of a type definition.

AddTypeReference(EntityHandle, StringHandle, StringHandle)

添加类型引用。Adds a type reference.

AddTypeSpecification(BlobHandle)
Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetOrAddBlob(BlobBuilder)

将指定的 blob 从不可变字节数组添加到 Blob 堆(如果尚不存在)。Adds the specified blob from an immutable byte array to the Blob heap, if it's not there already.

GetOrAddBlob(Byte[])

将指定的 blob 添加到 Blob 堆(如果尚不存在)。Adds the specified blob to the Blob heap, if it's not there already.

GetOrAddBlob(ImmutableArray<Byte>)

将指定的 blob 从字节数组添加到 Blob 堆(如果尚不存在)。Adds the specified blob from a byte array to the Blob heap, if it's not there already.

GetOrAddBlobUTF16(String)

使用 UTF16 编码向 blob 编码字符串,并将其添加到 Blob 堆(如果尚不存在)。Encodes a string using UTF16 encoding to a blob and adds it to the Blob heap, if it's not there already.

GetOrAddBlobUTF8(String, Boolean)

使用 UTF8 编码向 blob 编码字符串,并将其添加到 Blob 堆(如果尚不存在)。Encodes a string using UTF8 encoding to a blob and adds it to the Blob heap, if it's not there already.

GetOrAddConstantBlob(Object)

向 blob 编码常量值,并将其添加到 Blob 堆(如果尚不存在)。Encodes a constant value to a blob and adds it to the Blob heap, if it's not there already. 使用 UTF16 对字符串常量进行编码。Uses UTF16 to encode string constants.

GetOrAddDocumentName(String)

对调试文档名称进行编码,并将其添加到 Blob 堆(如果尚不存在)。Encodes a debug document name and adds it to the Blob heap, if it's not there already.

GetOrAddGuid(Guid)

将指定的 Guid 添加到 Guid 堆(如果尚不存在)。Adds the specified Guid to the Guid heap, if it's not there already.

GetOrAddString(String)

将指定的字符串添加到字符串堆(如果尚不存在)。Adds the specified string to the string heap, if it's not there already.

GetOrAddUserString(String)

将指定的字符串添加到用户字符串堆(如果尚不存在)。Adds the specified string to the user string heap, if it's not there already.

GetRowCount(TableIndex)

返回指定表中的当前项数。Returns the current number of items in the specified table.

GetRowCounts()

返回每个表中的当前项数。Returns the current number of items in each table.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ReserveGuid()

在 Guid 堆上为 GUID 保留空间。Reserves space on the Guid heap for a GUID.

ReserveUserString(Int32)

在用户字符串堆上为指定长度的字符串保留空间。Reserves space on the user string heap for a string of the specified length.

SetCapacity(HeapIndex, Int32)

设置指定堆的容量。Sets the capacity of the specified heap.

SetCapacity(TableIndex, Int32)

设置指定表的容量。Sets the capacity of the specified table.

ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于