Table of Contents

ConfigurationInlineCommentMode Enum

Definition

Namespace
Bodu.Text.Configuration
Assembly
Bodu.Text.Configuration.dll
Package
Bodu.Text.Configuration 1.0.0
Source
ConfigurationInlineCommentMode.cs

Controls how the reader treats # or ; characters that appear after a property value.

public enum ConfigurationInlineCommentMode
Extension Methods

Fields

Disabled = 0

Inline comments are not recognized. Any # or ; that appears in a value is preserved verbatim. This is the EditorConfig-compatible setting.

WhitespaceIntroduced = 1

Recognize an inline comment when, and only when, the comment prefix is preceded by at least one ASCII whitespace character. This is the default Bodu behaviour and minimizes the risk of accidentally truncating values that legitimately contain # or ;.

Always = 2

Always treat the first unescaped # or ; after the value separator as the start of a comment, even when not preceded by whitespace. Surrounding whitespace in the captured value is trimmed.

Remarks

EditorConfig 0.17.2 explicitly forbids inline comments - a # or ; anywhere other than the start of a line is part of the value. Bodu permits inline comments as an opt-in extension.

// value = 8 # comment  -- WhitespaceIntroduced treats "# comment" as a comment
// only when preceded by whitespace; Disabled keeps it as part of the value.
var options = new ConfigurationParseOptions
{
    InlineCommentMode = ConfigurationInlineCommentMode.WhitespaceIntroduced,
};

Applies to

ProductVersions
.NET8, 10