SyntaxFacts Class

Answers questions about a SyntaxKind that do not need a node to ask them of.

public static class SyntaxFacts

Methods

NameDescription
GetText(SyntaxKind)Returns the text a kind is always spelled with, or an empty string when its text varies.
IsComment(SyntaxKind)Determines whether kind is one of the comment trivia kinds.
IsTrivia(SyntaxKind)Determines whether kind is whitespace, a line break, or a comment.

GetText(SyntaxKind)

SyntaxFacts.cs

Returns the text a kind is always spelled with, or an empty string when its text varies.

public static string GetText(SyntaxKind kind)

Parameters

kind SyntaxKind

Returns

string

IsComment(SyntaxKind)

SyntaxFacts.cs

Determines whether kind is one of the comment trivia kinds.

public static bool IsComment(SyntaxKind kind)

Parameters

kind SyntaxKind

Returns

bool

IsTrivia(SyntaxKind)

SyntaxFacts.cs

Determines whether kind is whitespace, a line break, or a comment.

public static bool IsTrivia(SyntaxKind kind)

Parameters

kind SyntaxKind

Returns

bool