DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="4.4.1" />

 InterpolatedString

public static class InterpolatedString
Provides factory methods to create interpolated strings efficiently.
using DotNext.Buffers; using System; using System.Runtime.CompilerServices; namespace DotNext.Text { public static class InterpolatedString { [System.Runtime.CompilerServices.NullableContext(2)] [return: System.Runtime.CompilerServices.Nullable(0)] public static MemoryOwner<char> Allocate(MemoryAllocator<char> allocator, IFormatProvider provider, [InterpolatedStringHandlerArgument(new string[] { "allocator", "provider" })] ref PoolingInterpolatedStringHandler handler) { return handler.DetachBuffer(); } public static MemoryOwner<char> Allocate([System.Runtime.CompilerServices.Nullable(2)] MemoryAllocator<char> allocator, [InterpolatedStringHandlerArgument("allocator")] ref PoolingInterpolatedStringHandler handler) { return Allocate(allocator, null, ref handler); } } }