Soenneker.Utils.PooledStringBuilders
3.0.5
Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Soenneker.Utils.PooledStringBuilders --version 3.0.5
NuGet\Install-Package Soenneker.Utils.PooledStringBuilders -Version 3.0.5
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="Soenneker.Utils.PooledStringBuilders" Version="3.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Utils.PooledStringBuilders" Version="3.0.5" />
<PackageReference Include="Soenneker.Utils.PooledStringBuilders" />
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 Soenneker.Utils.PooledStringBuilders --version 3.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Soenneker.Utils.PooledStringBuilders, 3.0.5"
#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 Soenneker.Utils.PooledStringBuilders@3.0.5
#: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=Soenneker.Utils.PooledStringBuilders&version=3.0.5
#tool nuget:?package=Soenneker.Utils.PooledStringBuilders&version=3.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Soenneker.Utils.PooledStringBuilders
Tiny, fast ref struct string builder.
Backed by ArrayPool<char>. Low allocations. Short-lived use.
Install
dotnet add package Soenneker.Utils.PooledStringBuilders
Example
using Soenneker.Utils.PooledStringBuilders;
using var sb = new PooledStringBuilder(128);
sb.Append("Hello, ");
sb.Append(name);
sb.Append(' ');
sb.Append(id); // ISpanFormattable path, no boxing
sb.AppendLine();
string s = sb.ToString(); // returns string + returns buffer
Cheatsheet
new PooledStringBuilder(int capacity = 128)Append(char),Append(string?),Append(ReadOnlySpan<char>)Append<T>(T value, ReadOnlySpan<char> fmt = default, IFormatProvider? prov = null)whereT : ISpanFormattableAppendSpan(int length)→ write directly into the bufferAppendLine(),AppendSeparatorIfNotEmpty(char)Length,Capacity,Clear()ToString()(keep using; you mustDispose()later)ToStringAndDispose(bool clear = false)(one-shot finish)Dispose()/Dispose(bool clear)
Notes
ref struct→ stack-only. Don’t capture, box, store in fields, or crossawait.- Dispose when done.
usingshould be used, or there isToStringAndDispose(). Don't use both. - Handling secrets? Use
ToStringAndDispose(clear: true)to zero the array before returning to the pool. - Not thread-safe. Keep it short-lived and single-scope.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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.
-
net9.0
- No dependencies.
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Soenneker.Utils.PooledStringBuilders:
| Package | Downloads |
|---|---|
|
Soenneker.Redis.Util
The general purpose utility library leveraging Redis for all of your caching needs |
|
|
Soenneker.Extensions.Object
A collection of helpful Object extension methods |
|
|
Soenneker.Utils.Dotnet
A utility library for the dotnet executable |
|
|
Soenneker.Quark.Suite
The entire suite of Quark elements, all in one library. |
|
|
Soenneker.Quark.Variables.Bootstrap
CSS variable overrides for the latest version of Bootstrap. |
GitHub repositories
This package is not used by any popular GitHub repositories.