MetalamaAPI documentationAdvanced APIMetalama.​Framework.​Engine.​FormattingFormatting­AnnotationsWith­Generated­Code­Annotation
Open sandboxFocus

FormattingAnnotations.WithGeneratedCodeAnnotation Method

WithGeneratedCodeAnnotation(SyntaxToken, SyntaxAnnotation)

Annotates a syntax node with an annotation meaning that the syntax node and all its children are generated. The annotation is typically obtained from GeneratedCodeAnnotation, but it can also be created from CreateGeneratedCodeAnnotation(String).

Declaration
public static SyntaxToken WithGeneratedCodeAnnotation(this SyntaxToken node, SyntaxAnnotation annotation)
Parameters
Type Name Description
Microsoft.CodeAnalysis.SyntaxToken node

The input node.

Microsoft.CodeAnalysis.SyntaxAnnotation annotation

A Microsoft.CodeAnalysis.SyntaxAnnotation of kind GeneratedCodeAnnotationKind.

Returns
Type Description
Microsoft.CodeAnalysis.SyntaxToken

The annotated node.

WithGeneratedCodeAnnotation<T>(T, SyntaxAnnotation)

Annotates a syntax node with an annotation meaning that the syntax node and all its children are generated, except whose marked with WithSourceCodeAnnotation<T>(T). The annotation is typically obtained from GeneratedCodeAnnotation, but it can also be created from CreateGeneratedCodeAnnotation(String).

Declaration
public static T WithGeneratedCodeAnnotation<T>(this T node, SyntaxAnnotation annotation)
where T : SyntaxNode
Parameters
Type Name Description
T node

The input node.

Microsoft.CodeAnalysis.SyntaxAnnotation annotation

A Microsoft.CodeAnalysis.SyntaxAnnotation of kind GeneratedCodeAnnotationKind.

Returns
Type Description
T

The annotated node.

Type Parameters
Name Description
T

WithGeneratedCodeAnnotation(in SyntaxTrivia, SyntaxAnnotation)

Declaration
public static SyntaxTrivia WithGeneratedCodeAnnotation(this in SyntaxTrivia trivia, SyntaxAnnotation annotation)
Parameters
Type Name Description
Microsoft.CodeAnalysis.SyntaxTrivia trivia
Microsoft.CodeAnalysis.SyntaxAnnotation annotation
Returns
Type Description
Microsoft.CodeAnalysis.SyntaxTrivia