SyntaxFacts Class
Answers questions about INI kinds that do not need a tree.
public static class SyntaxFactsMethods
| Name | Description |
|---|---|
| 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.csGets the text a kind is always spelled with, or an empty string when it varies.
public static string GetText(SyntaxKind kind)IsAnyToken(SyntaxKind)
SyntaxFacts.cspublic static bool IsAnyToken(SyntaxKind kind)No documentation is available.
IsEntry(SyntaxKind)
SyntaxFacts.cspublic static bool IsEntry(SyntaxKind kind)No documentation is available.
IsPunctuation(SyntaxKind)
SyntaxFacts.cspublic static bool IsPunctuation(SyntaxKind kind)No documentation is available.
IsTrivia(SyntaxKind)
SyntaxFacts.cspublic static bool IsTrivia(SyntaxKind kind)No documentation is available.
IsValidKey(string, IniParseOptions?)
SyntaxFacts.csDetermines 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
textstring- The key.
optionsIniParseOptions?- The options of the document it goes into, as
SyntaxFactory.Keytakes them, ornullto check it asSyntaxFactory.Keydoes, whatever the options.
Returns
Exceptions
ArgumentNullExceptiontextisnull.
IsValidSectionName(string, IniParseOptions?)
SyntaxFacts.csDetermines 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
textstring- The section name.
optionsIniParseOptions?- The options of the document it goes into, as
SyntaxFactory.SectionNametakes them, ornullto check it asSyntaxFactory.SectionNamedoes, whatever the options.
Returns
Exceptions
ArgumentNullExceptiontextisnull.
IsValidValue(string, IniParseOptions?)
SyntaxFacts.csDetermines 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
valuestring- The value.
optionsIniParseOptions?- The options of the document it goes into, or
nullto check it asSyntaxFactory.Valuedoes, whatever the options.
Returns
Exceptions
ArgumentNullExceptionvalueisnull.
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.