नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
Determines if the specified custom attribute is defined.
Syntax
Parameters
pszCustomAttributeName
[in] Name of the custom attribute.
Return Value
If the custom attribute is defined, returns S_OK; otherwise, returns S_FALSE.
Example
The following example shows how to implement this method for a CDebugClassFieldSymbol object that exposes the IDebugCustomAttributeQuery interface.
HRESULT CDebugClassFieldSymbol::IsCustomAttributeDefined(
LPCOLESTR pszCustomAttribute
)
{
HRESULT hr = S_FALSE;
CComPtr<IMetaDataImport> pMetadata;
mdToken token = mdTokenNil;
CComPtr<IDebugField> pField;
CComPtr<IDebugCustomAttributeQuery> pCA;
ASSERT(IsValidWideStringPtr(pszCustomAttribute));
METHOD_ENTRY( CDebugClassFieldSymbol::IsCustomAttributeDefined );
IfFalseGo( pszCustomAttribute, E_INVALIDARG );
IfFailGo( m_spSH->GetMetadata( m_spAddress->GetModule(), &pMetadata ) );
IfFailGo( CDebugCustomAttribute::GetTokenFromAddress( m_spAddress, &token) );
IfFailGo( pMetadata->GetCustomAttributeByName( token,
pszCustomAttribute,
NULL,
NULL ) );
Error:
METHOD_EXIT( CDebugClassFieldSymbol::IsCustomAttributeDefined, hr );
if (hr != S_OK)
{
hr = S_FALSE;
}
return hr;
}