Share via


IMetaDataImport::GetCustomAttributeByName Method

Gets the custom attribute, given its name and owner.

HRESULT GetCustomAttributeByName (
   [in]  mdToken          tkObj,
   [in]  LPCWSTR          szName,
   [out] const void       **ppData,
   [out] ULONG            *pcbData
);

Parameters

  • tkObj
    [in] A metadata token representing the object that owns the custom attribute.

  • szName
    [in] The name of the custom attribute.

  • ppData
    [out] A pointer to an array of data that is the value of the custom attribute.

  • pcbData
    [out] The size in bytes of the data returned in *ppData.

Remarks

It is legal to define multiple custom attributes for the same owner; they may even have the same name. However, GetCustomAttributeByName returns only one instance. (GetCustomAttributeByName returns the first instance that it encounters.) To find all instances of a custom attribute, call the IMetaDataImport::EnumCustomAttributes method.

Requirements

Platforms: See .NET Framework System Requirements.

Header: Cor.h

Library: Included as a resource in MsCorEE.dll

.NET Framework Versions: 4, 3.5 SP1, 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0, 1.1, 1.0

See Also

Reference

IMetaDataImport Interface

IMetaDataImport2 Interface