Open sandboxFocus

Method WithGeneratedCodeAnnotation

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
SyntaxToken node

The input node.

SyntaxAnnotation annotation

A SyntaxAnnotation of kind GeneratedCodeAnnotationKind.

Returns
Type Description
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.

SyntaxAnnotation annotation

A 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
SyntaxTrivia trivia
SyntaxAnnotation annotation
Returns
Type Description
SyntaxTrivia