SyntaxEditor.ReplaceNode Method
Definition
Overloads
ReplaceNode(SyntaxNode, SyntaxNode) |
Replace the specified node with a different node. |
ReplaceNode(SyntaxNode, Func<SyntaxNode,SyntaxGenerator,SyntaxNode>) |
Replace the specified node with a node produced by the function. |
ReplaceNode(SyntaxNode, SyntaxNode)
Replace the specified node with a different node.
public:
void ReplaceNode(Microsoft::CodeAnalysis::SyntaxNode ^ node, Microsoft::CodeAnalysis::SyntaxNode ^ newNode);
public void ReplaceNode (Microsoft.CodeAnalysis.SyntaxNode node, Microsoft.CodeAnalysis.SyntaxNode newNode);
member this.ReplaceNode : Microsoft.CodeAnalysis.SyntaxNode * Microsoft.CodeAnalysis.SyntaxNode -> unit
Public Sub ReplaceNode (node As SyntaxNode, newNode As SyntaxNode)
Parameters
- node
- SyntaxNode
The node to replace that already exists in the tree.
- newNode
- SyntaxNode
The new node that will be placed into the tree in the existing node's location.
Applies to
ReplaceNode(SyntaxNode, Func<SyntaxNode,SyntaxGenerator,SyntaxNode>)
Replace the specified node with a node produced by the function.
public:
void ReplaceNode(Microsoft::CodeAnalysis::SyntaxNode ^ node, Func<Microsoft::CodeAnalysis::SyntaxNode ^, Microsoft::CodeAnalysis::Editing::SyntaxGenerator ^, Microsoft::CodeAnalysis::SyntaxNode ^> ^ computeReplacement);
public void ReplaceNode (Microsoft.CodeAnalysis.SyntaxNode node, Func<Microsoft.CodeAnalysis.SyntaxNode,Microsoft.CodeAnalysis.Editing.SyntaxGenerator,Microsoft.CodeAnalysis.SyntaxNode> computeReplacement);
member this.ReplaceNode : Microsoft.CodeAnalysis.SyntaxNode * Func<Microsoft.CodeAnalysis.SyntaxNode, Microsoft.CodeAnalysis.Editing.SyntaxGenerator, Microsoft.CodeAnalysis.SyntaxNode> -> unit
Public Sub ReplaceNode (node As SyntaxNode, computeReplacement As Func(Of SyntaxNode, SyntaxGenerator, SyntaxNode))
Parameters
- node
- SyntaxNode
The node to replace that already exists in the tree.
- computeReplacement
- Func<SyntaxNode,SyntaxGenerator,SyntaxNode>
A function that computes a replacement node. The node passed into the compute function includes changes from prior edits. It will not appear as a descendant of the original root.