Click or drag to resize

SyntaxNodeCopyAnnotationsToT Method



Copies all SyntaxAnnotations, if any, from this SyntaxNode instance and attaches them to a new instance based on node.

Namespace:  Microsoft.CodeAnalysis
Assembly:  Microsoft.CodeAnalysis (in Microsoft.CodeAnalysis.dll) Version: 2.3.0-dev-56735-00. Commit Hash: <developer build>
Syntax
public T CopyAnnotationsTo<T>(
	T node
)
where T : SyntaxNode

Parameters

node
Type: T

Type Parameters

T

Return Value

Type: T
Remarks

If no annotations are copied, just returns node.

It can also be used manually to preserve annotations in a more complex tree modification, even if the type of a node changes.

See Also