Show / Hide Table of Contents

Struct EncodingInterpolatedStringHandler

Represents converter of interpolated string directly to a sequence of bytes using the specified encoding.

Inherited Members
ValueType.Equals(object)
ValueType.GetHashCode()
ValueType.ToString()
object.GetType()
object.Equals(object, object)
object.ReferenceEquals(object, object)
Namespace: DotNext.Text
Assembly: DotNext.dll
Syntax
public ref struct EncodingInterpolatedStringHandler

Constructors

View Source

EncodingInterpolatedStringHandler(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

encoder is null.

InsufficientMemoryException

The interpolated string template is too long.

Methods

View Source

AppendFormatted(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.

View Source

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.

View Source

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.

View Source

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.

View Source

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.

Extension Methods

BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
Enumerator.Skip<TEnumerator, T>(ref TEnumerator, int)
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾