Aracılığıyla paylaş


SyntaxNodeExtensions.ReplaceTokens<TRoot> Method

Definition

Creates a new tree of nodes with the specified old node replaced with a new node.

public:
generic <typename TRoot>
 where TRoot : Microsoft::CodeAnalysis::SyntaxNode[System::Runtime::CompilerServices::Extension]
 static TRoot ReplaceTokens(TRoot root, System::Collections::Generic::IEnumerable<Microsoft::CodeAnalysis::SyntaxToken> ^ tokens, Func<Microsoft::CodeAnalysis::SyntaxToken, Microsoft::CodeAnalysis::SyntaxToken, Microsoft::CodeAnalysis::SyntaxToken> ^ computeReplacementToken);
public static TRoot ReplaceTokens<TRoot> (this TRoot root, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxToken> tokens, Func<Microsoft.CodeAnalysis.SyntaxToken,Microsoft.CodeAnalysis.SyntaxToken,Microsoft.CodeAnalysis.SyntaxToken> computeReplacementToken) where TRoot : Microsoft.CodeAnalysis.SyntaxNode;
static member ReplaceTokens : 'Root * seq<Microsoft.CodeAnalysis.SyntaxToken> * Func<Microsoft.CodeAnalysis.SyntaxToken, Microsoft.CodeAnalysis.SyntaxToken, Microsoft.CodeAnalysis.SyntaxToken> -> 'Root (requires 'Root :> Microsoft.CodeAnalysis.SyntaxNode)
<Extension()>
Public Function ReplaceTokens(Of TRoot As SyntaxNode) (root As TRoot, tokens As IEnumerable(Of SyntaxToken), computeReplacementToken As Func(Of SyntaxToken, SyntaxToken, SyntaxToken)) As TRoot

Type Parameters

TRoot

The type of the root node.

Parameters

root
TRoot

The root node of the tree of nodes.

tokens
IEnumerable<SyntaxToken>

The token to be replaced; descendants of the root node.

computeReplacementToken
Func<SyntaxToken,SyntaxToken,SyntaxToken>

A function that computes a replacement token for the argument tokens. The first argument is the original token. The second argument is the same token potentially rewritten with replaced trivia.

Returns

TRoot

Applies to