Struct EncodingInterpolatedStringHandler
Represents converter of interpolated string directly to a sequence of bytes using the specified encoding.
Inherited Members
Namespace: DotNext.Text
Assembly: DotNext.dll
Syntax
public ref struct EncodingInterpolatedStringHandler
Constructors
View SourceEncodingInterpolatedStringHandler(int, int, MemoryAllocator<byte>?, Encoder, Span<char>, IFormatProvider?)
Initializes a new interpolated string handler.
Declaration
public EncodingInterpolatedStringHandler(int literalLength, int formattedCount, MemoryAllocator<byte>? allocator, Encoder encoder, Span<char> buffer = default, IFormatProvider? provider = null)
Parameters
| Type | Name | Description |
|---|---|---|
| int | literalLength | The total number of characters in known at compile-time. |
| int | formattedCount | The number of placeholders. |
| MemoryAllocator<byte> | allocator | The allocator of the encoded buffer. |
| Encoder | encoder | The character encoder. |
| Span<char> | buffer | The preallocated temporary buffer for characters. |
| IFormatProvider | provider | The format provider. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| InsufficientMemoryException | The interpolated string template is too long. |
Methods
View SourceAppendFormatted(scoped ReadOnlySpan<char>)
Writes the specified character span to the handler.
Declaration
public void AppendFormatted(scoped ReadOnlySpan<char> value)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<char> | value | The span to write. |
AppendFormatted(scoped ReadOnlySpan<char>, int)
Writes the specified string of chars to the handler.
Declaration
public void AppendFormatted(scoped ReadOnlySpan<char> value, int alignment)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<char> | value | The span to write. |
| int | alignment | Minimum number of characters that should be written for this value. If the value is negative, it indicates left-aligned and the required minimum is the absolute value. |
AppendFormatted<T>(T, int, string?)
Writes the specified value to the handler.
Declaration
public void AppendFormatted<T>(T value, int alignment, string? format = null)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The value to write. |
| int | alignment | Minimum number of characters that should be written for this value. If the value is negative, it indicates left-aligned and the required minimum is the absolute value. |
| string | format | The format string. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the value to write. |
AppendFormatted<T>(T, string?)
Writes the specified value to the handler.
Declaration
public void AppendFormatted<T>(T value, string? format)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The value to write. |
| string | format | The format string. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the value to write. |
AppendLiteral(string?)
Writes the specified string to the handler.
Declaration
public void AppendLiteral(string? value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value | The string to write. |