Share via


SyntaxNodeExtensions.ReplaceTrivia Method

Definition

Overloads

ReplaceTrivia<TRoot>(TRoot, SyntaxTrivia, SyntaxTrivia)

Creates a new tree of nodes with the specified trivia replaced with new trivia.

ReplaceTrivia<TRoot>(TRoot, SyntaxTrivia, IEnumerable<SyntaxTrivia>)

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

ReplaceTrivia<TRoot>(TRoot, IEnumerable<SyntaxTrivia>, Func<SyntaxTrivia,SyntaxTrivia,SyntaxTrivia>)

Creates a new tree of nodes with the specified trivia replaced with new trivia.

ReplaceTrivia<TRoot>(TRoot, SyntaxTrivia, SyntaxTrivia)

Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs

Creates a new tree of nodes with the specified trivia replaced with new trivia.

public:
generic <typename TRoot>
 where TRoot : Microsoft::CodeAnalysis::SyntaxNode[System::Runtime::CompilerServices::Extension]
 static TRoot ReplaceTrivia(TRoot root, Microsoft::CodeAnalysis::SyntaxTrivia trivia, Microsoft::CodeAnalysis::SyntaxTrivia newTrivia);
public static TRoot ReplaceTrivia<TRoot> (this TRoot root, Microsoft.CodeAnalysis.SyntaxTrivia trivia, Microsoft.CodeAnalysis.SyntaxTrivia newTrivia) where TRoot : Microsoft.CodeAnalysis.SyntaxNode;
static member ReplaceTrivia : 'Root * Microsoft.CodeAnalysis.SyntaxTrivia * Microsoft.CodeAnalysis.SyntaxTrivia -> 'Root (requires 'Root :> Microsoft.CodeAnalysis.SyntaxNode)
<Extension()>
Public Function ReplaceTrivia(Of TRoot As SyntaxNode) (root As TRoot, trivia As SyntaxTrivia, newTrivia As SyntaxTrivia) As TRoot

Type Parameters

TRoot

The type of the root node.

Parameters

root
TRoot

The root node of the tree of nodes.

trivia
SyntaxTrivia

The trivia to be replaced.

newTrivia
SyntaxTrivia

The new trivia to use in the new tree in place of the old trivia.

Returns

TRoot

Applies to

ReplaceTrivia<TRoot>(TRoot, SyntaxTrivia, IEnumerable<SyntaxTrivia>)

Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs

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

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

Type Parameters

TRoot

The type of the root node.

Parameters

root
TRoot

The root of the tree of nodes.

oldTrivia
SyntaxTrivia

The trivia to be replaced; a descendant of the root node.

newTrivia
IEnumerable<SyntaxTrivia>

A sequence of trivia to use in the tree in place of the specified trivia.

Returns

TRoot

Applies to

ReplaceTrivia<TRoot>(TRoot, IEnumerable<SyntaxTrivia>, Func<SyntaxTrivia,SyntaxTrivia,SyntaxTrivia>)

Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs
Source:
SyntaxNodeExtensions.cs

Creates a new tree of nodes with the specified trivia replaced with new trivia.

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

Type Parameters

TRoot

The type of the root node.

Parameters

root
TRoot

The root node of the tree of nodes.

trivia
IEnumerable<SyntaxTrivia>

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

computeReplacementTrivia
Func<SyntaxTrivia,SyntaxTrivia,SyntaxTrivia>

A function that computes replacement trivia for the specified arguments. The first argument is the original trivia. The second argument is the same trivia with potentially rewritten sub structure.

Returns

TRoot

Applies to