Skip to main content

SymbolExtensions.HasAttribute Method

Containing Type: SymbolExtensions

Assembly: Roslynator.Core.dll

Overloads

MethodSummary
HasAttribute(ISymbol, INamedTypeSymbol)Returns true if the symbol has the specified attribute.
HasAttribute(ISymbol, MetadataName)Returns true if the symbol has attribute with the specified name.
HasAttribute(ITypeSymbol, INamedTypeSymbol, Boolean)Returns true if the type symbol has the specified attribute.
HasAttribute(ITypeSymbol, MetadataName, Boolean)Returns true if the type symbol has attribute with the specified name.

HasAttribute(ISymbol, INamedTypeSymbol)

Returns true if the symbol has the specified attribute.

public static bool HasAttribute(this Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.INamedTypeSymbol attributeClass)

Parameters

symbol ISymbol

attributeClass INamedTypeSymbol

Returns

Boolean

HasAttribute(ISymbol, MetadataName)

Returns true if the symbol has attribute with the specified name.

public static bool HasAttribute(this Microsoft.CodeAnalysis.ISymbol symbol, in Roslynator.MetadataName attributeName)

Parameters

symbol ISymbol

attributeName MetadataName

Returns

Boolean

HasAttribute(ITypeSymbol, INamedTypeSymbol, Boolean)

Returns true if the type symbol has the specified attribute.

public static bool HasAttribute(this Microsoft.CodeAnalysis.ITypeSymbol typeSymbol, Microsoft.CodeAnalysis.INamedTypeSymbol attributeClass, bool includeBaseTypes)

Parameters

typeSymbol ITypeSymbol

attributeClass INamedTypeSymbol

includeBaseTypes Boolean

Returns

Boolean

HasAttribute(ITypeSymbol, MetadataName, Boolean)

Returns true if the type symbol has attribute with the specified name.

public static bool HasAttribute(this Microsoft.CodeAnalysis.ITypeSymbol typeSymbol, in Roslynator.MetadataName attributeName, bool includeBaseTypes)

Parameters

typeSymbol ITypeSymbol

attributeName MetadataName

includeBaseTypes Boolean

Returns

Boolean