Table of Contents

Bodu.Text.Ini Namespace

Package

Bodu.Text.Ini

Purpose

Bodu.Text.Ini parses and emits INI documents - global keys plus [section] blocks of key=value entries - as a standalone System.Text.Json-shaped library: a typed serializer, a two-reader token surface, a comment-preserving mutable node DOM, and a read-only document DOM. It ships as its own package (also available through the Bodu.Text.Formats umbrella); see also Bodu.Text.Delimited and Bodu.Text.DotEnv. For EditorConfig-style layered configuration, use Bodu.Text.Configuration instead - it carries its own INI model.

Key types

Example

using Bodu.Text.Ini.Nodes;

IniObject root = IniNode.Parse("[server]\nhost=localhost\nport=8080\n"u8);
root["server"].AsObject()["port"].AsValue().Value = "9090";
byte[] back = root.ToUtf8Bytes();   // comments (had there been any) survive

Notes

  • Conservative dialect. = only; values run literally to end of line (an inline ; is content); ; and # start full-line comments.
  • Duplicate handling is a document-model policy. The source-order reader reports the file verbatim; Merge / LastWins (the defaults) apply when the document materializes.
  • See also: the line-formats introduction and the INI guide.

Namespaces

Bodu.Text.Ini.Document
Bodu.Text.Ini.Nodes
Bodu.Text.Ini.Reader
Bodu.Text.Ini.Writer

Classes

IniFormatException

Represents an error that occurs when INI data is malformed, such as an unterminated section header, an empty section name, or an entry with no assignment.

IniSectionAttribute

Marks a partial section POCO for compile-time INI binding: the Bodu.Text.Formats.Generators source generator emits an IIniSectionFactory<TSection> implementation for the type, exposed through a generated static IniFactory property.

IniSerializationException

Represents an error that occurs while mapping a .NET object to or from INI with IniSerializer, such as an unsupported root type, a member nested beyond INI's two levels, a missing required key, or a value that cannot be converted to the target type.

IniSerializer

Provides methods for serializing .NET objects to INI text and deserializing INI text into .NET objects, shaped after System.Text.Json's JsonSerializer.

IniSerializerOptions

Provides configuration for IniSerializer, controlling property naming, case sensitivity, field inclusion, null handling, the global-section mapping, and the duplicate-section/key policies.

Structs

IniDocumentOptions

Provides configuration for the INI document model, controlling how duplicate sections and duplicate keys are resolved when a document is materialized.

Interfaces

IIniSectionFactory<TSection>

Provides reflection-free conversion between a section type and its INI key/value representation, consumed by the IniSerializer section overloads.

Enums

IniDuplicateKeyBehavior

Specifies how the INI document model resolves a key that appears more than once within the same section.

IniDuplicateSectionBehavior

Specifies how the INI document model resolves a section name that appears more than once.

IniSerializerDefaults

Specifies a set of default settings an IniSerializerOptions can be initialized from.

IniTokenType

Enumerates the token kinds a Utf8IniReader reports as it advances through an INI document in source order.

IniValueKind

Enumerates the value kinds an INI node or element can represent.