SyntaxNodeExtensions.ReplaceTokens<TRoot> 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.
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
Applies to
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for