DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="5.16.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 { [NullableContext(2)] [return: Nullable(0)] public static MemoryOwner<char> Interpolate(MemoryAllocator<char> allocator, IFormatProvider provider, [InterpolatedStringHandlerArgument(new string[] { "allocator", "provider" })] ref PoolingInterpolatedStringHandler handler) { return handler.DetachBuffer(); } public static MemoryOwner<char> Interpolate([Nullable(2)] MemoryAllocator<char> allocator, [InterpolatedStringHandlerArgument("allocator")] ref PoolingInterpolatedStringHandler handler) { return Interpolate(allocator, null, ref handler); } } }