Struct FillTextInterpolatedStringHandler
Low-allocation interpolated string handler for building text in a stack-first inline buffer, spilling to a rented array only when the text exceeds 256 characters.
public ref struct FillTextInterpolatedStringHandler
- Inherited Members
Constructors
FillTextInterpolatedStringHandler(int, int)
Initializes the handler and allocates or rents a buffer of the appropriate size.
public FillTextInterpolatedStringHandler(int literalLength, int formattedCount)
Parameters
literalLengthintTotal character count of all literal string segments.
formattedCountintNumber of interpolated holes in the string.
Methods
AppendFormatted(object?)
Appends any object by calling ToString().
public void AppendFormatted(object? value)
Parameters
valueobject
AppendFormatted(ReadOnlySpan<char>)
Appends a ReadOnlySpan<T> of characters directly.
public void AppendFormatted(ReadOnlySpan<char> value)
Parameters
valueReadOnlySpan<char>
AppendFormatted(string?)
Appends a string value.
public void AppendFormatted(string? value)
Parameters
valuestring
AppendFormatted<T>(T)
Appends a span-formattable value using its default format.
public void AppendFormatted<T>(T value) where T : ISpanFormattable
Parameters
valueT
Type Parameters
T
AppendFormatted<T>(T, int)
Appends a span-formattable value with the specified alignment width.
public void AppendFormatted<T>(T value, int alignment) where T : ISpanFormattable
Parameters
valueTalignmentint
Type Parameters
T
AppendFormatted<T>(T, int, ReadOnlySpan<char>)
Appends a span-formattable value with the specified format and alignment width.
public void AppendFormatted<T>(T value, int alignment, ReadOnlySpan<char> format) where T : ISpanFormattable
Parameters
valueTalignmentintformatReadOnlySpan<char>
Type Parameters
T
AppendFormatted<T>(T, ReadOnlySpan<char>)
Appends a span-formattable value using the specified format string.
public void AppendFormatted<T>(T value, ReadOnlySpan<char> format) where T : ISpanFormattable
Parameters
valueTformatReadOnlySpan<char>
Type Parameters
T
AppendLiteral(string)
Appends a literal string segment to the buffer.
public void AppendLiteral(string s)
Parameters
sstring
AsSpan()
Returns the currently accumulated characters as a read-only span.
public readonly ReadOnlySpan<char> AsSpan()
Returns
Dispose()
Returns any rented array buffer back to the pool.
public void Dispose()