SyntaxNodeExtensions.ReplaceNodes<TRoot,TNode> 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, typename TNode>
where TRoot : Microsoft::CodeAnalysis::SyntaxNode where TNode : Microsoft::CodeAnalysis::SyntaxNode[System::Runtime::CompilerServices::Extension]
static TRoot ReplaceNodes(TRoot root, System::Collections::Generic::IEnumerable<TNode> ^ nodes, Func<TNode, TNode, Microsoft::CodeAnalysis::SyntaxNode ^> ^ computeReplacementNode);
public static TRoot ReplaceNodes<TRoot,TNode> (this TRoot root, System.Collections.Generic.IEnumerable<TNode> nodes, Func<TNode,TNode,Microsoft.CodeAnalysis.SyntaxNode> computeReplacementNode) where TRoot : Microsoft.CodeAnalysis.SyntaxNode where TNode : Microsoft.CodeAnalysis.SyntaxNode;
static member ReplaceNodes : 'Root * seq<'Node (requires 'Node :> Microsoft.CodeAnalysis.SyntaxNode)> * Func<'Node, 'Node, Microsoft.CodeAnalysis.SyntaxNode (requires 'Node :> Microsoft.CodeAnalysis.SyntaxNode and 'Node :> Microsoft.CodeAnalysis.SyntaxNode)> -> 'Root (requires 'Root :> Microsoft.CodeAnalysis.SyntaxNode and 'Node :> Microsoft.CodeAnalysis.SyntaxNode)
<Extension()>
Public Function ReplaceNodes(Of TRoot As SyntaxNode, TNode As SyntaxNode) (root As TRoot, nodes As IEnumerable(Of TNode), computeReplacementNode As Func(Of TNode, TNode, SyntaxNode)) As TRoot
Type Parameters
- TRoot
The type of the root node.
- TNode
The type of the nodes being replaced.
Parameters
- root
- TRoot
The root node of the tree of nodes.
- nodes
- IEnumerable<TNode>
The nodes to be replaced; descendants of the root node.
- computeReplacementNode
- Func<TNode,TNode,SyntaxNode>
A function that computes a replacement node for the argument nodes. The first argument is the original node. The second argument is the same node potentially rewritten with replaced descendants.
Returns
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應