SyntaxNode.CopyAnnotationsTo<T>(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.
Copies all SyntaxAnnotations, if any, from this SyntaxNode instance and attaches them to a new instance based on node
.
public:
generic <typename T>
where T : Microsoft::CodeAnalysis::SyntaxNode T CopyAnnotationsTo(T node);
public T CopyAnnotationsTo<T> (T node) where T : Microsoft.CodeAnalysis.SyntaxNode;
public T? CopyAnnotationsTo<T> (T? node) where T : Microsoft.CodeAnalysis.SyntaxNode;
member this.CopyAnnotationsTo : 'T -> 'T (requires 'T :> Microsoft.CodeAnalysis.SyntaxNode)
Public Function CopyAnnotationsTo(Of T As SyntaxNode) (node As T) As T
Type Parameters
- T
Parameters
- node
- T
Returns
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.
Applies to
Collaborer avec nous sur GitHub
La source de ce contenu se trouve sur GitHub, où vous pouvez également créer et examiner les problèmes et les demandes de tirage. Pour plus d’informations, consultez notre guide du contributeur.