CKTIS / C#
System.Text.StringBuilder: practical reference
System.Text.StringBuilder: practical reference: StringBuilder maintains a mutable character buffer for repeated text composition.
Version: .NET API; verified against .NET 10 reference surface
Syntax
System.Text.StringBuilder /* select a documented member or constructor */StringBuilder maintains a mutable character buffer for repeated text composition.
Use it for many appends when concatenation would create numerous intermediate strings.
ToString copies the result; StringBuilder is not safe for concurrent writes.
Capacity grows and may exceed expectations; an index outside Length throws.
The complete program actually uses System.Text.StringBuilder; its exact expected stdout is C# 10.
Examples
using System;
using System.Buffers;
using System.Collections.Concurrent;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Number = System.Int32;
var builder = new StringBuilder();
builder.Append("C#").Append(' ').Append(10);
Console.WriteLine(builder);
Result
C# 10
The complete program actually uses `System.Text.StringBuilder`; its exact expected stdout is `C# 10`.