SyntaxFacts Class

Answers questions about INI kinds that do not need a tree.

public static class SyntaxFacts

Methods

NameDescription
GetText(SyntaxKind)Gets the text a kind is always spelled with, or an empty string when it varies.
IsAnyToken(SyntaxKind)
IsEntry(SyntaxKind)
IsPunctuation(SyntaxKind)
IsTrivia(SyntaxKind)
IsValidKey(string, IniParseOptions?)Determines whether text can be written as a key, so that it reads back as that key.
IsValidSectionName(string, IniParseOptions?)Determines whether text can be written as a section name, so that it reads back as that name.
IsValidValue(string, IniParseOptions?)Determines whether value can be written as a value, quoted if need be, so that it reads back as that value.

GetText(SyntaxKind)

SyntaxFacts.cs

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

public static string GetText(SyntaxKind kind)

Parameters

kind SyntaxKind

Returns

string

IsAnyToken(SyntaxKind)

SyntaxFacts.cs
public static bool IsAnyToken(SyntaxKind kind)

Parameters

kind SyntaxKind

Returns

bool

No documentation is available.

IsEntry(SyntaxKind)

SyntaxFacts.cs
public static bool IsEntry(SyntaxKind kind)

Parameters

kind SyntaxKind

Returns

bool

No documentation is available.

IsPunctuation(SyntaxKind)

SyntaxFacts.cs
public static bool IsPunctuation(SyntaxKind kind)

Parameters

kind SyntaxKind

Returns

bool

No documentation is available.

IsTrivia(SyntaxKind)

SyntaxFacts.cs
public static bool IsTrivia(SyntaxKind kind)

Parameters

kind SyntaxKind

Returns

bool

No documentation is available.

IsValidKey(string, IniParseOptions?)

SyntaxFacts.cs

Determines whether text can be written as a key, so that it reads back as that key.

public static bool IsValidKey(string text, IniParseOptions? options = null)

Parameters

text string
The key.
options IniParseOptions?
The options of the document it goes into, as SyntaxFactory.Key takes them, or null to check it as SyntaxFactory.Key does, whatever the options.

Returns

bool

Exceptions

ArgumentNullException
text is null.

IsValidSectionName(string, IniParseOptions?)

SyntaxFacts.cs

Determines whether text can be written as a section name, so that it reads back as that name.

public static bool IsValidSectionName(string text, IniParseOptions? options = null)

Parameters

text string
The section name.
options IniParseOptions?
The options of the document it goes into, as SyntaxFactory.SectionName takes them, or null to check it as SyntaxFactory.SectionName does, whatever the options.

Returns

bool

Exceptions

ArgumentNullException
text is null.

IsValidValue(string, IniParseOptions?)

SyntaxFacts.cs

Determines whether value can be written as a value, quoted if need be, so that it reads back as that value.

public static bool IsValidValue(string value, IniParseOptions? options = null)

Parameters

value string
The value.
options IniParseOptions?
The options of the document it goes into, or null to check it as SyntaxFactory.Value does, whatever the options.

Returns

bool

Exceptions

ArgumentNullException
value is null.

Remarks

With options, a value with line breaks can be written when they allow multiline values, as SyntaxFactory.IniProperty writes it. A value is always written in front of a line break; in front of the comment of an existing line, IniPropertySyntax.WithValue may still refuse it.