Table of Contents

ConfigurationProfile Enum

Definition

Namespace
Bodu.Text.Configuration
Assembly
Bodu.Text.Configuration.dll
Package
Bodu.Text.Configuration 1.3.0
Source
ConfigurationProfile.cs

Selects one of the predefined behavior profiles that govern how a configuration document is parsed, resolved, and re-emitted.

public enum ConfigurationProfile
Extension Methods

Fields

Bodu = 0

The default Bodu profile: EditorConfig-style section headers and globs, dotted-to-colon key mapping, last-wins duplicate handling, whitespace-introduced inline comments, and preamble properties contributing to resolution, except the preamble's root pair, which marks the file as the root of its directory tree and is never resolved.

EditorConfigCompatible = 1

Strict alignment with the public EditorConfig specification 0.17.2: inline comments disabled, identity key mapping so a key keeps its dots, keys lowercased with the invariant culture, and the preamble left out of resolution, root included. The preamble's pairs stay in the document's global section; resolution reads one document and searches no parent directory, so acting on root = true is left to the caller.

Strict = 2

Strict, deterministic parsing for generated files: duplicate keys are rejected, unknown syntax throws, inline comments are disabled, and key-only properties are not permitted.

Relaxed = 3

Permissive parsing for user-authored files: inline comments enabled, duplicates resolved by last-wins, diagnostics collected rather than thrown.

Examples

// Start from the profile closest to the desired behaviour, then override only what differs.
ConfigurationParseOptions options = ConfigurationParseOptions.For(ConfigurationProfile.Strict);
ConfigurationDocument document = ConfigurationDocument.Parse(text, options);

Remarks

A profile is the single source of truth for an option set. Each ConfigurationParseOptions, ConfigurationResolveOptions, and ConfigurationWriteOptions exposes a For(profile) factory which produces an options bag preconfigured for the selected profile.

Profiles encode opinionated combinations of orthogonal switches. Mixing them is supported - start from the closest preset and override the few properties that differ. The behavioral matrix is:

BehaviorBodu | EditorConfigCompatible | Strict | Relaxed
Inline comments (ConfigurationInlineCommentMode)WhitespaceIntroduced | Disabled | Disabled | WhitespaceIntroduced
Duplicate keys (DuplicateKeyPolicy)LastWins | LastWins | Disallowed | LastWins
Duplicate sections (IniDuplicateSectionBehavior)Preserve | Preserve | Disallowed | Preserve
Section header trailing content (ConfigurationSectionHeaderMode)Lenient | Strict | Strict | Lenient
Diagnostic routing (ConfigurationDiagnosticMode)Throw | Throw | Throw | Collect
Preamble contributes to resolved view (ApplyPreambleProperties; its root pair never does) Yes | No | Yes | Yes
unset sentinel (ConfigurationUnsetValueMode)TreatAsLiteral | RemoveEffectiveValue | RemoveEffectiveValue | TreatAsLiteral
Missing path root (ConfigurationMissingPathRootMode)UseEmptyRoot | Throw | Throw | UseEmptyRoot
Key mapping (Mapping)DotToColon | Identity | DotToColon | DotToColon
Keys lowercased (LowercaseKeys)No | Yes | No | No

Applies to

ProductVersions
.NET8, 10