IMetaDataImport::GetCustomAttributeByName method (rometadataapi.h)

Gets the custom attribute, given its name and owner.

Syntax

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

Parameters

[in] tkObj

A metadata token representing the object that owns the custom attribute.

[in] szName

The name of the custom attribute.

[out] ppData

A pointer to an array of data that is the value of the custom attribute.

[out] pcbData

The size in bytes of the data returned in const.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

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 EnumCustomAttributes method.

Requirements

Requirement Value
Target Platform Windows
Header rometadataapi.h

See also

IMetaDataImport