IniParseOptions Class

Configures how IniSyntaxTree parses text.

public sealed class IniParseOptions : IEquatable<IniParseOptions>

Remarks

INI has no specification, so these options select between the behaviors of the common dialects.

Implements

Constructors

NameDescription
IniParseOptions()

IniParseOptions()

IniParseOptions.cs
public IniParseOptions()

No documentation is available.

Properties

NameDescription
AllowEscapesGets a value indicating whether a backslash escapes the character after it in a value, quoted or not: \\, \', \", \;, \#, \=, \:, \0, \a, \b, \t, \r, and \n.
AllowKeysWithoutValueGets a value indicating whether a line holding only a key, such as skip-networking in a MySQL option file, is a property. When it is not allowed, the line is still read as a property, and INI0004 is reported.
AllowMultilineValuesGets a value indicating whether a value continues on the lines that follow it when they are indented more than its key, as Python's configparser reads them.
AllowQuotedValuesGets a value indicating whether a value wholly in double or single quotes, such as "a;b", is read without them, so that ; and # inside them never start a comment. Defaults to true.
DefaultGets the options used when none are given.
DialectGets the family of syntax the document is read with. Defaults to IniDialect.Generic.
GitGets the options that read git configuration files, such as .gitconfig or .git/config.
InlineCommentsGets where ; and # start a comment other than at the beginning of a line.
NameComparerGets how section names and keys are compared to find duplicates. Defaults to StringComparer.OrdinalIgnoreCase, or, with IniDialect.Git, to a comparer that ignores the case of section names and keys but not of subsections, as git does: Remote.origin is remote.origin, not remote.Origin.
ReportDuplicatesGets a value indicating whether a section name used twice (INI0006) and a key used twice in the same section (INI0007) are reported as warnings. Names are compared with IniParseOptions.NameComparer.

AllowEscapes

IniParseOptions.cs

Gets a value indicating whether a backslash escapes the character after it in a value, quoted or not: \\, \', \", \;, \#, \=, \:, \0, \a, \b, \t, \r, and \n.

public bool AllowEscapes { get; init; }

Property value

bool

Remarks

An escaped ; or # never starts a comment, and an escaped quote never closes a quoted value. A backslash in front of any other character, or at the end of the line, is an ordinary character. Keys and section names are not escaped. An edit writes a value with line breaks as \r and \n on one line, so that it reads back exactly as it was, even when IniParseOptions.AllowMultilineValues is set.

AllowKeysWithoutValue

IniParseOptions.cs

Gets a value indicating whether a line holding only a key, such as skip-networking in a MySQL option file, is a property. When it is not allowed, the line is still read as a property, and INI0004 is reported.

public bool AllowKeysWithoutValue { get; init; }

Property value

bool

AllowMultilineValues

IniParseOptions.cs

Gets a value indicating whether a value continues on the lines that follow it when they are indented more than its key, as Python's configparser reads them.

public bool AllowMultilineValues { get; init; }

Property value

bool

Remarks

As in configparser, a comment line between the lines of a value is skipped, and a blank line between them is an empty line of the value. Each line is read like a one-line value, so its quotes and its comment are not part of it.

AllowQuotedValues

IniParseOptions.cs

Gets a value indicating whether a value wholly in double or single quotes, such as "a;b", is read without them, so that ; and # inside them never start a comment. Defaults to true.

public bool AllowQuotedValues { get; init; }

Property value

bool

Remarks

Set it to false for dialects where quotes are ordinary characters, such as Python's configparser: the value of key="a" is then "a", quotes included, and an edit never adds quotes to a value.

Gets the options used when none are given.

public static IniParseOptions Default { get; }

Property value

IniParseOptions

Gets the family of syntax the document is read with. Defaults to IniDialect.Generic.

public IniDialect Dialect { get; init; }

Property value

IniDialect

Exceptions

ArgumentOutOfRangeException
The value is not one of IniDialect.

Remarks

Gets the options that read git configuration files, such as .gitconfig or .git/config.

public static IniParseOptions Git { get; }

Property value

IniParseOptions

Remarks

InlineComments

IniParseOptions.cs

Gets where ; and # start a comment other than at the beginning of a line.

public IniInlineCommentMode InlineComments { get; init; }

Property value

IniInlineCommentMode

Exceptions

ArgumentOutOfRangeException
The value is not one of IniInlineCommentMode.

Remarks

A value in quotes, such as "a;b", never contains a comment, whatever this says.

NameComparer

IniParseOptions.cs

Gets how section names and keys are compared to find duplicates. Defaults to StringComparer.OrdinalIgnoreCase, or, with IniDialect.Git, to a comparer that ignores the case of section names and keys but not of subsections, as git does: Remote.origin is remote.origin, not remote.Origin.

public StringComparer NameComparer { get; init; }

Property value

StringComparer

Exceptions

ArgumentNullException
The value is null.

ReportDuplicates

IniParseOptions.cs

Gets a value indicating whether a section name used twice (INI0006) and a key used twice in the same section (INI0007) are reported as warnings. Names are compared with IniParseOptions.NameComparer.

public bool ReportDuplicates { get; init; }

Property value

bool

Methods

NameDescription
Equals(IniParseOptions?)
Equals(object?)
GetHashCode()
ToString()

Equals overloads

Equals(IniParseOptions?)

public bool Equals(IniParseOptions? other)
Parameters
other IniParseOptions?
Returns

bool

No documentation is available.

Equals(object?)

public override bool Equals(object? obj)
Parameters
obj object?
Returns

bool

No documentation is available.

GetHashCode()

public override int GetHashCode()

Returns

int

No documentation is available.

ToString()

public override string ToString()

Returns

string

No documentation is available.

Operators

NameDescription
operator ==(IniParseOptions?, IniParseOptions?)
operator !=(IniParseOptions?, IniParseOptions?)

operator ==(IniParseOptions?, IniParseOptions?)

public static bool operator ==(IniParseOptions? left, IniParseOptions? right)

Parameters

left IniParseOptions?
right IniParseOptions?

Returns

bool

No documentation is available.

operator !=(IniParseOptions?, IniParseOptions?)

public static bool operator !=(IniParseOptions? left, IniParseOptions? right)

Parameters

left IniParseOptions?
right IniParseOptions?

Returns

bool

No documentation is available.