Bia.ValueBuffers 0.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Bia.ValueBuffers --version 0.2.0
                    
NuGet\Install-Package Bia.ValueBuffers -Version 0.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bia.ValueBuffers" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bia.ValueBuffers" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Bia.ValueBuffers" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bia.ValueBuffers --version 0.2.0
                    
#r "nuget: Bia.ValueBuffers, 0.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bia.ValueBuffers@0.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bia.ValueBuffers&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Bia.ValueBuffers&version=0.2.0
                    
Install as a Cake Tool

Bia.ValueBuffers

.NET C# Build Status codecov Nuget License

High-performance, stack-first value-type buffers for .NET. Zero-allocation where possible, ArrayPool-backed overflow. Cross-platform, trimmable and AOT/NativeAOT compatible.

⭐ Please star this project if you like it. ⭐

Example | Example Catalogue | Public API

Example

// ValueStringBuilder — stack-first string building, zero allocation on the happy path
Span<char> buf = stackalloc char[128];
var sb = new ValueStringBuilder(buf);
sb.Append("Hello");
sb.Append(", ");
sb.Append("World");
sb.Append('!');
string greeting = sb.ToString(); // disposes builder and returns pooled memory

// ValueRingBuffer<T> — fixed-capacity circular buffer backed by stackalloc
Span<int> ring = stackalloc int[4];
var rb = new ValueRingBuffer<int>(ring);
rb.Write(1);
rb.Write(2);
rb.Write(3);
rb.Write(4);
rb.Write(5); // buffer is full — overwrites oldest element (1)
int oldest = rb.Read(); // returns 2 (FIFO)

_ = greeting;
_ = oldest;

For more examples see Example Catalogue.

Benchmarks

Run dotnet Build.cs comparison-bench then dotnet test to populate results locally.

Detailed Benchmarks

Comparison Benchmarks
TestBench Benchmark Results

Example Catalogue

The following examples are available in ReadMeTest.cs.

Example - Empty

// ValueStringBuilder — stack-first string building, zero allocation on the happy path
Span<char> buf = stackalloc char[128];
var sb = new ValueStringBuilder(buf);
sb.Append("Hello");
sb.Append(", ");
sb.Append("World");
sb.Append('!');
string greeting = sb.ToString(); // disposes builder and returns pooled memory

// ValueRingBuffer<T> — fixed-capacity circular buffer backed by stackalloc
Span<int> ring = stackalloc int[4];
var rb = new ValueRingBuffer<int>(ring);
rb.Write(1);
rb.Write(2);
rb.Write(3);
rb.Write(4);
rb.Write(5); // buffer is full — overwrites oldest element (1)
int oldest = rb.Read(); // returns 2 (FIFO)

_ = greeting;
_ = oldest;

Public API Reference

See docs/PublicApi.md for the complete auto-generated public API reference.

Note: docs/PublicApi.md is auto-updated by the ReadMeTest_PublicApi test on every dotnet test run. Do not edit it manually.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Bia.ValueBuffers:

Package Downloads
Maple.Text

MapleStory rich-text parsing: tokenizes and strips MapleStory custom markup for use in UI text rendering. Cross-platform, trimmable and AOT/NativeAOT compatible.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.9.0 1,305 4/12/2026
0.8.0 142 4/12/2026
0.7.0 147 4/11/2026
0.6.0 151 4/11/2026
0.5.0 145 4/11/2026
0.4.0 146 4/11/2026
0.3.0 148 4/11/2026
0.2.0 152 4/11/2026
0.1.0 249 4/4/2026