SpanTools.ValueStringBuilder.Generator 1.0.0-alpha.113

This is a prerelease version of SpanTools.ValueStringBuilder.Generator.
dotnet add package SpanTools.ValueStringBuilder.Generator --version 1.0.0-alpha.113
                    
NuGet\Install-Package SpanTools.ValueStringBuilder.Generator -Version 1.0.0-alpha.113
                    
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="SpanTools.ValueStringBuilder.Generator" Version="1.0.0-alpha.113" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SpanTools.ValueStringBuilder.Generator" Version="1.0.0-alpha.113" />
                    
Directory.Packages.props
<PackageReference Include="SpanTools.ValueStringBuilder.Generator" />
                    
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 SpanTools.ValueStringBuilder.Generator --version 1.0.0-alpha.113
                    
#r "nuget: SpanTools.ValueStringBuilder.Generator, 1.0.0-alpha.113"
                    
#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 SpanTools.ValueStringBuilder.Generator@1.0.0-alpha.113
                    
#: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=SpanTools.ValueStringBuilder.Generator&version=1.0.0-alpha.113&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=SpanTools.ValueStringBuilder.Generator&version=1.0.0-alpha.113&prerelease
                    
Install as a Cake Tool

SpanTools for .NET

GitHub GitHub Sponsors

This package provides Roslyn code generators to create a ValueStringBuilder ref struct in your project.

ValueStringBuilder is included in the BCL, but is an internal type and not available to users. This package allows you to include ValueStringBuilder along with extended support for Insert operations, IndexOf operations, LastIndexOf operations, code points, string formatting, max length tracking, and more.

Configuration

The following options are user configurable via MSBuild properties.

Option Default Value Description
ValueStringBuilder_Namespace RootNamespace ?? AssemblyName Sets the namespace of the ValueStringBuilder ref struct. Use the value global:: to specify the global namespace.
ValueStringBuilder_IncludeMaxLengthTracking false Enables the MaxLength, CapacityExceeded, and FitsInitialBuffer() members. This can be used to write directly to the Span<char> that is passed to the constructor. FitsInitalBuffer() returns the number of characters written or the minimum length of buffer required to re-attempt the operation.
ValueStringBuilder_IncludeAsMemoryMethods false Enables AsMemory() method overloads. These can be used to get a ReadOnlyMemory<char> to pass as fields of heap-only types such as classes if (and only if) used in conjunction with the ValueStringBuilder(int initialCapacity) constructor. The consumer is responsible for ensuring the returned ReadOnlyMemory<char> goes out of scope prior to calling ValueStringBuilder.Dispose(), when the memory used will be returned to the array pool.
ValueStringBuilder_IncludesJ2N false Indicates that J2N is available as a package dependency. Generally, this option does not have to be set because J2N will be detected automatically if part of the dependency graph.
ValueStringBuilder_IncludeCodepointSupport true If J2N is referenced as a PackageReference, this enables the AppendCodePoint(), InsertCodePoint(), CodePointAt(), CodePointBefore(), CodePointCount(), and OffsetByCodePoints() methods. If J2N is not referenced, this has no effect.
ValueStringBuilder_UseJavaStyleFormatting false If J2N is referenced as a PackageReference, this changes the default behavior of the Append() overloads that accept numeric types to use the invariant culture and J format to emulate Java-style floating point number formatting. If J2N is not referenced, this has no effect.
ValueStringBuilder_UseJavaStyleIndexOf false If J2N is referenced as a PackageReference, this changes the default behavior of the IndexOf() and LastIndexOf() overloads to use Java-style clamping behavior of startIndex and return values for special cases, such as matching empty strings. If J2N is not referenced, this has no effect.

Why a Code Generator instead of a Library?

Distributing as a code generator has the following advantages and disadvantages.

Advantages
  1. No NuGet dependencies are shipped with your NuGet package. The code is included within your assembly.
  2. Shipping as a partial class allows you to extend it directly and manipulate the private state of the type directly with your extensions.
Disadvantages
  1. Users don't have a way to upgrade the generated code if there are updates. To upgrade, you must deploy a new version.

NuGet

Nuget


Saying Thanks

If you find these libraries to be useful, please star us on GitHub and consider a sponsorship so we can continue bringing you great free tools like these. It really would make a big difference!

GitHub Sponsors

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.113 10,334 6/23/2026
1.0.0-alpha.112 68 6/23/2026
1.0.0-alpha.111 75 6/21/2026