Compartilhar via


CSharpExtensions.ReplaceTrivia Method

Definition

Overloads

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

Creates a new token with the specified old trivia replaced with computed new trivia.

ReplaceTrivia(SyntaxToken, SyntaxTrivia, SyntaxTrivia)

Creates a new token with the specified old trivia replaced with a new trivia. The old trivia may appear in the token's leading or trailing trivia.

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

Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs

Creates a new token with the specified old trivia replaced with computed new trivia.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::CodeAnalysis::SyntaxToken ReplaceTrivia(Microsoft::CodeAnalysis::SyntaxToken token, System::Collections::Generic::IEnumerable<Microsoft::CodeAnalysis::SyntaxTrivia> ^ trivia, Func<Microsoft::CodeAnalysis::SyntaxTrivia, Microsoft::CodeAnalysis::SyntaxTrivia, Microsoft::CodeAnalysis::SyntaxTrivia> ^ computeReplacementTrivia);
public static Microsoft.CodeAnalysis.SyntaxToken ReplaceTrivia (this Microsoft.CodeAnalysis.SyntaxToken token, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.SyntaxTrivia> trivia, Func<Microsoft.CodeAnalysis.SyntaxTrivia,Microsoft.CodeAnalysis.SyntaxTrivia,Microsoft.CodeAnalysis.SyntaxTrivia> computeReplacementTrivia);
static member ReplaceTrivia : Microsoft.CodeAnalysis.SyntaxToken * seq<Microsoft.CodeAnalysis.SyntaxTrivia> * Func<Microsoft.CodeAnalysis.SyntaxTrivia, Microsoft.CodeAnalysis.SyntaxTrivia, Microsoft.CodeAnalysis.SyntaxTrivia> -> Microsoft.CodeAnalysis.SyntaxToken
<Extension()>
Public Function ReplaceTrivia (token As SyntaxToken, trivia As IEnumerable(Of SyntaxTrivia), computeReplacementTrivia As Func(Of SyntaxTrivia, SyntaxTrivia, SyntaxTrivia)) As SyntaxToken

Parameters

token
SyntaxToken
trivia
IEnumerable<SyntaxTrivia>

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

computeReplacementTrivia
Func<SyntaxTrivia,SyntaxTrivia,SyntaxTrivia>

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

Returns

Applies to

ReplaceTrivia(SyntaxToken, SyntaxTrivia, SyntaxTrivia)

Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs
Source:
CSharpExtensions.cs

Creates a new token with the specified old trivia replaced with a new trivia. The old trivia may appear in the token's leading or trailing trivia.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::CodeAnalysis::SyntaxToken ReplaceTrivia(Microsoft::CodeAnalysis::SyntaxToken token, Microsoft::CodeAnalysis::SyntaxTrivia oldTrivia, Microsoft::CodeAnalysis::SyntaxTrivia newTrivia);
public static Microsoft.CodeAnalysis.SyntaxToken ReplaceTrivia (this Microsoft.CodeAnalysis.SyntaxToken token, Microsoft.CodeAnalysis.SyntaxTrivia oldTrivia, Microsoft.CodeAnalysis.SyntaxTrivia newTrivia);
static member ReplaceTrivia : Microsoft.CodeAnalysis.SyntaxToken * Microsoft.CodeAnalysis.SyntaxTrivia * Microsoft.CodeAnalysis.SyntaxTrivia -> Microsoft.CodeAnalysis.SyntaxToken
<Extension()>
Public Function ReplaceTrivia (token As SyntaxToken, oldTrivia As SyntaxTrivia, newTrivia As SyntaxTrivia) As SyntaxToken

Parameters

token
SyntaxToken
oldTrivia
SyntaxTrivia

The trivia to be replaced.

newTrivia
SyntaxTrivia

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

Returns

Applies to