Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IMetaDataImport::GetCustomAttributeByName method

Gets the custom attribute, given its name and owner.

Syntax


HRESULT GetCustomAttributeByName(
  [in]                       mdToken tkObj,
  [in]                       LPCWSTR szName,
  [out, size_is(, *pcbData)] BYTE    const,
  [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.

const [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 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

IDL

Rometadataapi.idl

See also

IMetaDataImport

 

 

Show: