IMetaDataImport Interface

 

Provides methods for importing and manipulating existing metadata from a portable executable (PE) file or other source, such as a type library or a stand-alone, run-time metadata binary.

MethodDescription
CloseEnum MethodCloses the enumerator with the specified handle.
CountEnum MethodGets the number of elements in the enumerator with the specified handle.
EnumCustomAttributes MethodEnumerates a list of custom attribute-definition tokens associated with the specified type or member.
EnumEvents MethodEnumerates event definition tokens for the specified TypeDef token.
EnumFields MethodEnumerates FieldDef tokens for the type referenced by the specified TypeDef token.
EnumFieldsWithName MethodEnumerates FieldDef tokens of the specified type with the specified name.
EnumInterfaceImpls MethodEnumerates MethodDef tokens representing interface implementations.
EnumMemberRefs MethodEnumerates MemberRef tokens representing members of the specified type.
EnumMembers MethodEnumerates MemberDef tokens representing members of the specified type.
EnumMembersWithName MethodEnumerates MemberDef tokens representing members of the specified type with the specified name.
EnumMethodImpls MethodEnumerates MethodBody and MethodDeclaration tokens representing methods of the specified type.
EnumMethods MethodEnumerates MethodDef tokens representing methods of the specified type.
EnumMethodSemantics MethodEnumerates the properties and the property-change events to which the specified method is related.
EnumMethodsWithName MethodEnumerates methods that have the specified name and that are defined by the type referenced by the specified TypeDef token.
EnumModuleRefs MethodEnumerates ModuleRef tokens that represent imported modules.
EnumParams MethodEnumerates ParamDef tokens representing the parameters of the method referenced by the specified MethodDef token.
EnumPermissionSets MethodEnumerates permissions for the objects in a specified metadata scope.
EnumProperties MethodEnumerates PropertyDef tokens representing the properties of the type referenced by the specified TypeDef token.
EnumSignatures MethodEnumerates Signature tokens representing stand-alone signatures in the current scope.
EnumTypeDefs MethodEnumerates TypeDef tokens representing all types within the current scope.
EnumTypeRefs MethodEnumerates TypeRef tokens defined in the current metadata scope.
EnumTypeSpecs MethodEnumerates TypeSpec tokens defined in the current metadata scope.
EnumUnresolvedMethods MethodEnumerates MemberDef tokens representing the unresolved methods in the current metadata scope.
EnumUserStrings MethodEnumerates String tokens representing hard-coded strings in the current metadata scope.
FindField MethodGets the FieldDef token for the field that is a member of the specified type, and has the specified name and metadata signature.
FindMember MethodGets a pointer to the MemberDef token for the member defined by the specified type with the specified name and metadata signature.
FindMemberRef MethodGets a pointer to the MemberRef token for the member defined by the specified type with the specified name and metadata signature.
FindMethod MethodGets a pointer to the MethodDef token for the method defined by the specified type with the specified name and metadata signature.
FindTypeDefByName MethodGets a pointer to the TypeDef metadata token for the type with the specified name.
FindTypeRef MethodGets a pointer to the TypeRef metadata token that references the type in the specified search scope with the specified name.
GetClassLayout MethodGets layout information for the class referenced by the specified TypeDef token.
GetCustomAttributeByName MethodGets the value of the custom attribute, given its name.
GetCustomAttributeProps MethodGets the value of the custom attribute, given its metadata token.
GetEventProps MethodGets metadata information (including the declaring type, the add and remove methods for delegates, and any flags and other associated data) for the event represented by the specified event token.
GetFieldMarshal MethodGets a pointer to the native, unmanaged type of the field represented by the specified Field metadata token.
GetFieldProps MethodGets metadata associated with the field referenced by the specified FieldDef token.
GetInterfaceImplProps MethodGets a pointer to the metadata tokens for the type that implements the specified method and for the interface that declares that method.
GetMemberProps MethodGets metadata information (including the name, binary signature, and relative virtual address) of the type member referenced by the specified metadata token.
GetMemberRefProps MethodGets metadata associated with the member referenced by the specified token.
GetMethodProps MethodGets the metadata associated with the method referenced by the specified MethodDef token.
GetMethodSemantics MethodGets a pointer to the relationship between the method referenced by the specified MethodDef token and the paired property and event referenced by the specified EventProp token.
GetModuleFromScope MethodGets a pointer to the metadata token for the module referenced in the current metadata scope.
GetModuleRefProps MethodGets the name of the module referenced by the specified metadata token.
GetNameFromToken MethodGets the UTF-8 name of the object referenced by the specified metadata token.
GetNativeCallConvFromSig MethodGets the native calling convention for the method that is represented by the specified signature pointer.
GetNestedClassProps MethodGets the TypeDef token for the enclosing parent type of the specified nested type.
GetParamForMethodIndex MethodGets a pointer to the token that represents the parameter at the specified ordinal position in the sequence of method parameters for the method represented by the specified MethodDef token.
GetParamProps MethodGets metadata values for the parameter referenced by the specified ParamDef token.
GetPermissionSetProps MethodGets the metadata associated with the System.Security.PermissionSet represented by the specified Permission token.
GetPinvokeMapGets a ModuleRef token to represent the target assembly of a PInvoke call.
GetPropertyProps MethodGets the metadata associated with the property represented by the specified token.
GetRVA MethodGets the offset of the relative virtual address of the code object represented by the specified token.
GetScopeProps MethodGets the name and optionally the version identifier of the assembly or module in the current metadata scope.
GetSigFromToken MethodGets the binary metadata signature associated with the specified token.
GetTypeDefProps MethodReturns metadata information for the type represented by the specified TypeDef token.
GetTypeRefProps MethodGets the metadata associated with the type referenced by the specified TypeRef token.
GetTypeSpecFromToken MethodGets the binary metadata signature of the type specification represented by the specified token.
GetUserString MethodGets the literal string represented by the specified metadata token.
IsGlobal MethodGets a value indicating whether the field, method, or type represented by the specified metadata token has global scope.
IsValidToken MethodGets a value indicating whether the specified token holds a valid reference to a code object.
ResetEnum MethodResets the specified enumerator to the specified position.
ResolveTypeRef MethodGets type information for the type referenced by the specified TypeRef token.

The design of the IMetaDataImport interface is intended primarily to be used by tools and services that will be importing type information (for example, development tools) or managing deployed components (for example, resolution/activation services). The methods in IMetaDataImport fall into the following task categories:

  • Enumerating collections of items in the metadata scope.

  • Finding an item that has a specific set of characteristics.

  • Getting properties of a specified item.

  • The Get methods are specifically designed to return single-valued properties of a metadata item. When the property is a reference to another item, a token for that item is returned. Any pointer input type can be NULL to indicate that the particular value is not being requested. To obtain properties that are essentially collection objects (for example, the collection of interfaces that a class implements), use the enumeration methods.

Platforms: See System Requirements.

Header: Cor.h

Library: Used as a resource in MsCorEE.dll

.NET Framework Versions: Available since 1.0

Metadata Interfaces
IMetaDataImport2 Interface

Show: