System.Reflection.Metadata Namespace

Provides low-level functionality for reading assembly metadata according to ECMA-335. This namespace is designed to be used by compilers and other tools that need to read assembly metadata.

Classes

Name Description
HandleComparer
MetadataReader

Reads metadata as defined by the ECMA 335 CLI specification.

MetadataStringDecoder

Provides the MetadataReader with a custom mechanism for decoding byte sequences in metadata that represent text.

MethodBodyBlock

Represents the method body in ECMA 335 assembly.

PEReaderExtensions

Structs

Name Description
AssemblyDefinition
AssemblyDefinitionHandle
AssemblyFile
AssemblyFileHandle
AssemblyFileHandleCollection

Represents a collection of AssemblyFileHandle.

AssemblyFileHandleCollection.Enumerator
AssemblyReference
AssemblyReferenceHandle
AssemblyReferenceHandleCollection

A collection of assembly references.

AssemblyReferenceHandleCollection.Enumerator
BlobHandle
BlobReader
Constant
ConstantHandle
CustomAttribute

Provides information about a custom attribute.

CustomAttributeHandle
CustomAttributeHandleCollection
CustomAttributeHandleCollection.Enumerator
DeclarativeSecurityAttribute
DeclarativeSecurityAttributeHandle
DeclarativeSecurityAttributeHandleCollection
DeclarativeSecurityAttributeHandleCollection.Enumerator
EntityHandle

Represents a metadata entity (such as a type reference, type definition, type specification, method definition, or custom attribute).

EventAccessors
EventDefinition
EventDefinitionHandle
EventDefinitionHandleCollection
EventDefinitionHandleCollection.Enumerator
ExceptionRegion
ExportedType
ExportedTypeHandle
ExportedTypeHandleCollection

Represents a collection of TypeReferenceHandle instances.

ExportedTypeHandleCollection.Enumerator
FieldDefinition
FieldDefinitionHandle
FieldDefinitionHandleCollection
FieldDefinitionHandleCollection.Enumerator
GenericParameter
GenericParameterConstraint
GenericParameterConstraintHandle
GenericParameterConstraintHandleCollection

Represents a collection of constraints of a generic type parameter.

GenericParameterConstraintHandleCollection.Enumerator
GenericParameterHandle
GenericParameterHandleCollection

Represents a collection of generic type parameters of a method or type.

GenericParameterHandleCollection.Enumerator
GuidHandle
Handle

Represents any metadata entity (such as a type reference, a type definition, a type specification, a method definition, or a custom attribute) or value (a string, blob, guid, or user string).

InterfaceImplementation
InterfaceImplementationHandle
InterfaceImplementationHandleCollection
InterfaceImplementationHandleCollection.Enumerator
ManifestResource
ManifestResourceHandle
ManifestResourceHandleCollection

Represents a collection of ManifestResourceHandle instances.

ManifestResourceHandleCollection.Enumerator
MemberReference
MemberReferenceHandle
MemberReferenceHandleCollection

Represents a collection of MemberReferenceHandle instances.

MemberReferenceHandleCollection.Enumerator
MetadataStringComparer

Provides string comparison helpers to query strings in metadata while avoiding allocation if possible.

MethodDefinition
MethodDefinitionHandle
MethodDefinitionHandleCollection
MethodDefinitionHandleCollection.Enumerator
MethodImplementation
MethodImplementationHandle
MethodImplementationHandleCollection
MethodImplementationHandleCollection.Enumerator
MethodImport
MethodSpecification
MethodSpecificationHandle
ModuleDefinition
ModuleDefinitionHandle
ModuleReference
ModuleReferenceHandle
NamespaceDefinition
NamespaceDefinitionHandle

Provides a handle to a namespace definition.

Parameter
ParameterHandle
ParameterHandleCollection

Contains a collection of parameters of a specified method.

ParameterHandleCollection.Enumerator
PropertyAccessors
PropertyDefinition
PropertyDefinitionHandle
PropertyDefinitionHandleCollection
PropertyDefinitionHandleCollection.Enumerator
SignatureHeader

Represents the signature characteristics specified by the leading byte of signature blobs.

StandaloneSignature
StandaloneSignatureHandle
StringHandle
TypeDefinition
TypeDefinitionHandle
TypeDefinitionHandleCollection

Contains a collection of TypeDefinitionHandle instances.

TypeDefinitionHandleCollection.Enumerator
TypeLayout
TypeReference
TypeReferenceHandle
TypeReferenceHandleCollection

Contains a collection of TypeReferenceHandle instances.

TypeReferenceHandleCollection.Enumerator
TypeSpecification
TypeSpecificationHandle
UserStringHandle

Represents a handle to the user string heap.

Enums

Name Description
ConstantTypeCode

Specifies values that represent types of metadata constants.

CustomAttributeNamedArgumentKind

Specifies constants that define the kinds of arguments in a custom attribute signature.

ExceptionRegionKind
HandleKind
MemberReferenceKind

Specifies constants that indicate whether a MemberReference references a method or field.

MetadataKind
MetadataReaderOptions
SerializationTypeCode

Specifies type codes used to encode the types of values in a CustomAttributeValue<TType> blob.

SignatureAttributes

Specifies additional flags that can be applied to method signatures. The underlying values of the fields in this type correspond to the representation in the leading signature byte represented by a SignatureHeader structure.

SignatureCallingConvention

Specifies how arguments in a given signature are passed from the caller to the callee. The underlying values of the fields in this type correspond to the representation in the leading signature byte represented by a SignatureHeader structure.

SignatureKind

Specifies the signature kind. The underlying values of the fields in this type correspond to the representation in the leading signature byte represented by a SignatureHeader structure.

SignatureTypeCode

Specifies constants that define type codes used in signature encoding.

Remarks

Caution

The metadata-reading types in this namespace, such as MetadataReader and MetadataReaderProvider, aren't designed to handle untrusted input. Malformed or malicious PE files, metadata, or PDB inputs can cause unexpected behavior, including out-of-bounds memory access, crashes, or hangs. Only use these APIs with trusted metadata, PE files, and PDB inputs. The TypeName and AssemblyNameInfo types are safe for use with untrusted input.

This namespace contains the following core classes:

See also