NDepend.API Documentation
HasAttribute Method (ExtensionMethodsCQLinqDependency)
NDepend.Reserved.CQLinq Namespace > ExtensionMethodsCQLinqDependency Class : HasAttribute Method
This NDepend.CodeModel.IAttributeTarget object. A NDepend.CodeModel.IAttributeTarget object can be a NDepend.CodeModel.IAssembly, NDepend.CodeModel.IType, NDepend.CodeModel.IMethod or NDepend.CodeModel.IField object.
The NDepend.CodeModel.ICodeElement.FullName of the attribute type.
The string attributeTypeFullName can contain wildcard '*' characters but cannot be just a single wildcard string "*".
If one or several code elements are matched by attributeTypeFullName, this method has a tagged by any behavior.
Returns true if this attributeTargetCodeElement is directly tagged by a attribute class whose NDepend.CodeModel.ICodeElement.FullName is attributeTypeFullName. This method can only be called in a ICQLinqExecutionContext, otherwise the method NDepend.CodeModel.IAttributeTarget.NDepend.CodeModel.IAttributeTarget.HasAttribute must be called instead.
Syntax

Parameters

attributeTargetCodeElement
This NDepend.CodeModel.IAttributeTarget object. A NDepend.CodeModel.IAttributeTarget object can be a NDepend.CodeModel.IAssembly, NDepend.CodeModel.IType, NDepend.CodeModel.IMethod or NDepend.CodeModel.IField object.
attributeTypeFullName
The NDepend.CodeModel.ICodeElement.FullName of the attribute type.
The string attributeTypeFullName can contain wildcard '*' characters but cannot be just a single wildcard string "*".
If one or several code elements are matched by attributeTypeFullName, this method has a tagged by any behavior.
Exceptions
ExceptionDescription
This extension method cannot be called from a program consuming NDepend.API. In such context, the method NDepend.CodeModel.IAttributeTarget.NDepend.CodeModel.IAttributeTarget.HasAttribute must be called instead.
Remarks
If one or several attribute classes are matched by attributeTypeFullName, they will be listed in NDepend.CodeQuery.IQueryExecutionSuccessResult.TargetCodeElements.
In the context of a CQLinq compiled query, this method has a constant time complexity.
Requirements

Target Platforms: Windows 11, 10, 8, 7 and Linux, MacOS with net8.0, net7.0 or net6.0 installed

See Also

Reference

ExtensionMethodsCQLinqDependency Class
ExtensionMethodsCQLinqDependency Members