DotNext by .NET Foundation and Contributors

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

 InterpolatedString

public static class InterpolatedString
using DotNext.Buffers; using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace DotNext.Text { public static class InterpolatedString { [NullableContext(2)] [return: Nullable(0)] public static MemoryOwner<char> Interpolate(MemoryAllocator<char> allocator, IFormatProvider provider, [In] [IsReadOnly] [InterpolatedStringHandlerArgument(new string[] { "allocator", "provider" })] ref PoolingInterpolatedStringHandler handler) { PoolingInterpolatedStringHandler poolingInterpolatedStringHandler = handler; return poolingInterpolatedStringHandler.DetachBuffer(); } public static MemoryOwner<char> Interpolate([Nullable(2)] MemoryAllocator<char> allocator, [In] [IsReadOnly] [InterpolatedStringHandlerArgument("allocator")] ref PoolingInterpolatedStringHandler handler) { return Interpolate(allocator, null, ref handler); } } }