IMetaDataImport::FindMember Method

Gets a pointer to the MemberDef token for field or method that is enclosed by the specified Type and that has the specified name and metadata signature.


HRESULT FindMember (  
   [in]  mdTypeDef         td,  
   [in]  LPCWSTR           szName,   
   [in]  PCCOR_SIGNATURE   pvSigBlob,   
   [in]  ULONG             cbSigBlob,   
   [out] mdToken           *pmb  


[in] The TypeDef token for the class or interface that encloses the member to search for. If this value is mdTokenNil, the lookup is done for a global-variable or global-function.

[in] The name of the member to search for.

[in] A pointer to the binary metadata signature of the member.

[in] The size in bytes of pvSigBlob.

[out] A pointer to the matching MemberDef token.


You specify the member using its enclosing class or interface (td), its name (szName), and optionally its signature (pvSigBlob). There might be multiple members with the same name in a class or interface. In that case, pass the member's signature to find the unique match.

The signature passed to FindMember must have been generated in the current scope, because signatures are bound to a particular scope. A signature can embed a token that identifies the enclosing class or value type. The token is an index into the local TypeDef table. You cannot build a run-time signature outside the context of the current scope and use that signature as input to input to FindMember.

FindMember finds only members that were defined directly in the class or interface; it does not find inherited members.


FindMember is a helper method. It calls IMetaDataImport::FindMethod; if that call does not find a match, FindMember then calls IMetaDataImport::FindField.


Platforms: See System Requirements.

Header: Cor.h

Library: Included as a resource in MsCorEE.dll

.NET Framework Versions: Available since 1.0

See Also

IMetaDataImport Interface
IMetaDataImport2 Interface