Udostępnij za pośrednictwem


GeneratorAttributeSyntaxContext Struct

Definition

public readonly struct GeneratorAttributeSyntaxContext
type GeneratorAttributeSyntaxContext = struct
Public Structure GeneratorAttributeSyntaxContext
Inheritance
GeneratorAttributeSyntaxContext

Properties

Attributes

AttributeDatas for any matching attributes on TargetSymbol. Always non-empty. All these attributes will have an AttributeClass whose fully qualified name metadata name matches the name requested in ForAttributeWithMetadataName<T>(String, Func<SyntaxNode,CancellationToken,Boolean>, Func<GeneratorAttributeSyntaxContext,CancellationToken,T>).

To get the entire list of attributes, use GetAttributes() on TargetSymbol.

SemanticModel

Semantic model for the file that TargetNode is contained within.

TargetNode

The syntax node the attribute is attached to. For example, with [CLSCompliant] class C { } this would the class declaration node.

TargetSymbol

The symbol that the attribute is attached to. For example, with [CLSCompliant] class C { } this would be the INamedTypeSymbol for "C".

Applies to