Skip to main content

SyntaxExtensions.TrimTrailingTrivia Method

Containing Type: SyntaxExtensions

Assembly: Roslynator.CSharp.dll

Overloads​

MethodSummary
TrimTrailingTrivia(SyntaxToken)Removes all trailing whitespace from the trailing trivia and returns a new token with the new trailing trivia. SyntaxKind.WhitespaceTrivia and SyntaxKind.EndOfLineTrivia is considered to be a whitespace. Returns the same token if there is nothing to trim.
TrimTrailingTrivia<TNode>(TNode)Removes all trailing whitespace from the trailing trivia and returns a new node with the new trailing trivia. SyntaxKind.WhitespaceTrivia and SyntaxKind.EndOfLineTrivia is considered to be a whitespace. Returns the same node if there is nothing to trim.

TrimTrailingTrivia(SyntaxToken)​

Removes all trailing whitespace from the trailing trivia and returns a new token with the new trailing trivia. SyntaxKind.WhitespaceTrivia and SyntaxKind.EndOfLineTrivia is considered to be a whitespace. Returns the same token if there is nothing to trim.

public static Microsoft.CodeAnalysis.SyntaxToken TrimTrailingTrivia(this Microsoft.CodeAnalysis.SyntaxToken token)

Parameters​

token   SyntaxToken

Returns​

SyntaxToken

TrimTrailingTrivia<TNode>(TNode)​

Removes all trailing whitespace from the trailing trivia and returns a new node with the new trailing trivia. SyntaxKind.WhitespaceTrivia and SyntaxKind.EndOfLineTrivia is considered to be a whitespace. Returns the same node if there is nothing to trim.

public static TNode TrimTrailingTrivia<TNode>(this TNode node) where TNode : Microsoft.CodeAnalysis.SyntaxNode

Type Parameters​

TNode

Parameters​

node   TNode

Returns​

TNode