Table of Contents

Runnable samples

The repository ships runnable, self-contained sample projects for Bodu.Core under samples/Core/. All three samples are offline and deterministic - they run against fixed inputs and small committed byte fixtures - and are members of bodu.slnx, built and executed by CI, so the code they show cannot drift from the current API. Each sample's README documents every scenario individually: its intent, what the code does, the output to expect, and the APIs demonstrated.

Run any sample from the repository root:

dotnet run --project samples/Core/<SampleName>

The samples

Bodu.Core.Samples.FunctionalRailway

The Bodu.Functional seam - railway-oriented primitives that replace null, out-parameters, and exception-driven control flow with composable values: Option<T> for absence (Map/Bind/Filter/Match), Result / Result<T> for a validate → parse → transform railway that short-circuits on the first ResultError, Either<TLeft, TRight> for a typed either/or, Memoizer caching a pure function (the invocation counter advances once per distinct argument), and the Task-based async companions (MapAsync/BindAsync). Package: Bodu.Core.

Bodu.Core.Samples.CoreToolbox

The everyday utility surface: SequenceGenerator (Fibonacci, Range, Thue-Morse, Farey, and more, all bounded), the pooled PooledBufferBuilder<T> output builder, the Bodu.Collections.Generic.Extensions LINQ operators (Batch, Windowed, Pairwise, Scan, RunLengthEncode, Interleave, ZipLongest), the string transforms (slug/kebab/snake/Pascal casing, diacritic removal) with the comparable and numeric extensions, WeekPattern presets and parse/format, and the deterministic single-flow use of the Bodu.Threading async primitives (AsyncLazy, AsyncManualResetEvent, AsyncLock). Package: Bodu.Core.

Bodu.Core.Samples.TextEncoding

The Bodu.Text encoding utilities over committed byte fixtures: EncodingDetection BOM sniffing across UTF-8/UTF-16LE/UTF-16BE preambles with an explicit UTF-8 fallback for BOM-less input, EncodingExtensions transcoding between UTF-16 and UTF-8 with preamble handling and replacement/exception fallbacks, and StringEncodingExtensions byte-count probes and pooled encoding (ToUtf8Bytes, GetUtf8BytesPooled, TryEncodeUtf8To). Package: Bodu.Core.