System.Reflection.Metadata.Ecma335.MetadataBuilder
The MetadataBuilder class writes metadata for an assembly in a highly performant manner. It is designed for use by compilers and other assembly generation tools.
public MetadataBuilder(int userStringHeapStartOffset = 0, int stringHeapStartOffset = 0, int blobHeapStartOffset = 0, int guidHeapStartOffset = 0)
Creates a builder for metadata tables and heaps.
public AssemblyDefinitionHandle AddAssembly(StringHandle name, Version version, StringHandle culture, BlobHandle publicKey, AssemblyFlags flags, AssemblyHashAlgorithm hashAlgorithm)
public AssemblyFileHandle AddAssemblyFile(StringHandle name, BlobHandle hashValue, bool containsMetadata)
public AssemblyReferenceHandle AddAssemblyReference(StringHandle name, Version version, StringHandle culture, BlobHandle publicKeyOrToken, AssemblyFlags flags, BlobHandle hashValue)
Adds a default value for a parameter, field or property.
public CustomAttributeHandle AddCustomAttribute(EntityHandle parent, EntityHandle constructor, BlobHandle value)
Adds a custom attribute.
public CustomDebugInformationHandle AddCustomDebugInformation(EntityHandle parent, GuidHandle kind, BlobHandle value)
Adds custom debug information.
public DeclarativeSecurityAttributeHandle AddDeclarativeSecurityAttribute(EntityHandle parent, DeclarativeSecurityAction action, BlobHandle permissionSet)
Adds a declarative security attribute to a type, method, or assembly.
public DocumentHandle AddDocument(BlobHandle name, GuidHandle hashAlgorithm, BlobHandle hash, GuidHandle language)
Adds document debug information.
public EventDefinitionHandle AddEvent(EventAttributes attributes, StringHandle name, EntityHandle type)
Adds an event definition.
public ExportedTypeHandle AddExportedType(TypeAttributes attributes, StringHandle namespace, StringHandle name, EntityHandle implementation, int typeDefinitionId)
Adds an exported type.
public FieldDefinitionHandle AddFieldDefinition(FieldAttributes attributes, StringHandle name, BlobHandle signature)
Adds a field definition.
Defines a field layout of a field definition.
Adds a mapping from a field to its initial value stored in the PE image.
public GenericParameterHandle AddGenericParameter(EntityHandle parent, GenericParameterAttributes attributes, StringHandle name, int index)
Adds a generic parameter definition.
public GenericParameterConstraintHandle AddGenericParameterConstraint(GenericParameterHandle genericParameter, EntityHandle constraint)
Adds a type constraint to a generic parameter.
Adds local scope debug information.
public InterfaceImplementationHandle AddInterfaceImplementation(TypeDefinitionHandle type, EntityHandle implementedInterface)
Adds an interface implementation to a type.
Adds local constant debug information.
public LocalScopeHandle AddLocalScope(MethodDefinitionHandle method, ImportScopeHandle importScope, LocalVariableHandle variableList, LocalConstantHandle constantList, int startOffset, int length)
Adds local scope debug information.
public LocalVariableHandle AddLocalVariable(LocalVariableAttributes attributes, int index, StringHandle name)
Adds local variable debug information.
public ManifestResourceHandle AddManifestResource(ManifestResourceAttributes attributes, StringHandle name, EntityHandle implementation, uint offset)
Adds a manifest resource.
Adds marshalling information to a field or a parameter.
public MemberReferenceHandle AddMemberReference(EntityHandle parent, StringHandle name, BlobHandle signature)
Adds a MemberRef table row.
public MethodDebugInformationHandle AddMethodDebugInformation(DocumentHandle document, BlobHandle sequencePoints)
Adds method debug information.
public MethodDefinitionHandle AddMethodDefinition(MethodAttributes attributes, MethodImplAttributes implAttributes, StringHandle name, BlobHandle signature, int bodyOffset, ParameterHandle parameterList)
Adds a method definition.
public MethodImplementationHandle AddMethodImplementation(TypeDefinitionHandle type, EntityHandle methodBody, EntityHandle methodDeclaration)
Defines an implementation for a method declaration within a type.
public void AddMethodImport(MethodDefinitionHandle method, MethodImportAttributes attributes, StringHandle name, ModuleReferenceHandle module)
Adds import information to a method definition.
public void AddMethodSemantics(EntityHandle association, MethodSemanticsAttributes semantics, MethodDefinitionHandle methodDefinition)
Associates a method (a getter, a setter, an adder, etc.) with a property or an event.
public MethodSpecificationHandle AddMethodSpecification(EntityHandle method, BlobHandle instantiation)
Adds a method specification (an instantiation).
public ModuleDefinitionHandle AddModule(int generation, StringHandle moduleName, GuidHandle mvid, GuidHandle encId, GuidHandle encBaseId)
Defines a nesting relationship to specified type definitions.
public ParameterHandle AddParameter(ParameterAttributes attributes, StringHandle name, int sequenceNumber)
Adds a parameter definition.
public PropertyDefinitionHandle AddProperty(PropertyAttributes attributes, StringHandle name, BlobHandle signature)
Adds a property definition.
public void AddPropertyMap(TypeDefinitionHandle declaringType, PropertyDefinitionHandle propertyList)
public void AddStateMachineMethod(MethodDefinitionHandle moveNextMethod, MethodDefinitionHandle kickoffMethod)
Adds state machine method debug information.
public TypeDefinitionHandle AddTypeDefinition(TypeAttributes attributes, StringHandle namespace, StringHandle name, EntityHandle baseType, FieldDefinitionHandle fieldList, MethodDefinitionHandle methodList)
Adds a type definition.
Defines a type layout of a type definition.
public TypeReferenceHandle AddTypeReference(EntityHandle resolutionScope, StringHandle namespace, StringHandle name)
Adds a type reference.
Adds the specified blob from an immutable byte array to the Blob heap, if it's not there already.
Adds the specified blob to the Blob heap, if it's not there already.
Adds the specified blob from a byte array to the Blob heap, if it's not there already.
Encodes a string using UTF16 encoding to a blob and adds it to the Blob heap, if it's not there already.
Encodes a string using UTF8 encoding to a blob and adds it to the Blob heap, if it's not there already.
Encodes a constant value to a blob and adds it to the Blob heap, if it's not there already. Uses UTF16 to encode string constants.
Encodes a debug document name and adds it to the Blob heap, if it's not there already.
Adds the specified Guid to the Guid heap, if it's not there already.
Adds the specified string to the string heap, if it's not there already.
Adds the specified string to the user string heap, if it's not there already.
Returns the current number of items in the specified table.
Returns the current number of items in each table.
Reserves space on the Guid heap for a GUID.
Reserves space on the user string heap for a string of the specified length.
Sets the capacity of the specified table.
Sets the capacity of the specified heap.