DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="4.0.0-beta.3" />

 MemoryTemplate<T>

public struct MemoryTemplate<T> where T : IEquatable<T>
Represents generic template for buffer rendering.
public ReadOnlyMemory<T> Value { get; }

Gets original template passed to this object during construction.

public MemoryTemplate(ReadOnlyMemory<T> template, ReadOnlySpan<T> placeholder)

Initializes a new pre-compiled template.

public void Render<TConsumer>(TConsumer consumer) where TConsumer : IReadOnlySpanConsumer<T>, IConsumer<int>

Replaces all placeholders in the template with custom content.

public void Render<TWriter>(TWriter output, Action<int, TWriter> rewriter) where TWriter : IBufferWriter<T>

Replaces all placeholders in the template with custom content.

public void Render<TArg>(TArg arg, Action<int, TArg> rewriter, ReadOnlySpanAction<T, TArg> output)

Replaces all placeholders in the template with custom content.