SyntaxValueProvider.ForAttributeWithMetadataName<T> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates an IncrementalValuesProvider<TValues> that can provide a transform over all SyntaxNodes if that node has an attribute on it that binds to a INamedTypeSymbol with the
same fully-qualified metadata as the provided fullyQualifiedMetadataName
. fullyQualifiedMetadataName
should be the fully-qualified, metadata name of the attribute, including the
Attribute
suffix. For example "System.CLSCompliantAttribute"
for CLSCompliantAttribute.
public Microsoft.CodeAnalysis.IncrementalValuesProvider<T> ForAttributeWithMetadataName<T> (string fullyQualifiedMetadataName, Func<Microsoft.CodeAnalysis.SyntaxNode,System.Threading.CancellationToken,bool> predicate, Func<Microsoft.CodeAnalysis.GeneratorAttributeSyntaxContext,System.Threading.CancellationToken,T> transform);
member this.ForAttributeWithMetadataName : string * Func<Microsoft.CodeAnalysis.SyntaxNode, System.Threading.CancellationToken, bool> * Func<Microsoft.CodeAnalysis.GeneratorAttributeSyntaxContext, System.Threading.CancellationToken, 'T> -> Microsoft.CodeAnalysis.IncrementalValuesProvider<'T>
Public Function ForAttributeWithMetadataName(Of T) (fullyQualifiedMetadataName As String, predicate As Func(Of SyntaxNode, CancellationToken, Boolean), transform As Func(Of GeneratorAttributeSyntaxContext, CancellationToken, T)) As IncrementalValuesProvider(Of T)
Type Parameters
- T
Parameters
- fullyQualifiedMetadataName
- String
- predicate
- Func<SyntaxNode,CancellationToken,Boolean>
A function that determines if the given SyntaxNode attribute target (TargetNode) should be transformed. Nodes that do not pass this predicate will not have their attributes looked at at all.
- transform
- Func<GeneratorAttributeSyntaxContext,CancellationToken,T>
A function that performs the transform. This will only be passed nodes that return true
for predicate
and which have a matching AttributeData whose
AttributeClass has the same fully qualified, metadata name as fullyQualifiedMetadataName
.