Table of Contents

Method TryWrite

Namespace
Zyl.ExSpans
Assembly
ExSpans.dll

TryWrite(ExSpan<char>, ref ExTryWriteInterpolatedStringHandler, out nint)

Writes the specified interpolated string to the character span.

public static bool TryWrite(this ExSpan<char> destination, ref ExTryWriteInterpolatedStringHandler handler, out nint charsWritten)

Parameters

destination ExSpan<char>

The span to which the interpolated string should be formatted.

handler ExTryWriteInterpolatedStringHandler

The interpolated string.

charsWritten nint

The number of characters written to the span.

Returns

bool

true if the entire interpolated string could be formatted successfully; otherwise, false.

TryWrite(ExSpan<char>, IFormatProvider?, ref ExTryWriteInterpolatedStringHandler, out nint)

Writes the specified interpolated string to the character span.

public static bool TryWrite(this ExSpan<char> destination, IFormatProvider? provider, ref ExTryWriteInterpolatedStringHandler handler, out nint charsWritten)

Parameters

destination ExSpan<char>

The span to which the interpolated string should be formatted.

provider IFormatProvider

An object that supplies culture-specific formatting information.

handler ExTryWriteInterpolatedStringHandler

The interpolated string.

charsWritten nint

The number of characters written to the span.

Returns

bool

true if the entire interpolated string could be formatted successfully; otherwise, false.

TryWrite<TArg0>(ExSpan<char>, IFormatProvider?, CompositeFormat, out nint, TArg0)

Writes the CompositeFormat string to the character span, substituting the format item or items with the string representation of the corresponding arguments.

public static bool TryWrite<TArg0>(this ExSpan<char> destination, IFormatProvider? provider, CompositeFormat format, out nint charsWritten, TArg0 arg0)

Parameters

destination ExSpan<char>

The span to which the string should be formatted.

provider IFormatProvider

An object that supplies culture-specific formatting information.

format CompositeFormat

A CompositeFormat.

charsWritten nint

The number of characters written to the span.

arg0 TArg0

The first object to format.

Returns

bool

true if the entire interpolated string could be formatted successfully; otherwise, false.

Type Parameters

TArg0

The type of the first object to format.

Exceptions

ArgumentNullException

format is null.

FormatException

The index of a format item is greater than or equal to the number of supplied arguments.

TryWrite<TArg0, TArg1>(ExSpan<char>, IFormatProvider?, CompositeFormat, out nint, TArg0, TArg1)

Writes the CompositeFormat string to the character span, substituting the format item or items with the string representation of the corresponding arguments.

public static bool TryWrite<TArg0, TArg1>(this ExSpan<char> destination, IFormatProvider? provider, CompositeFormat format, out nint charsWritten, TArg0 arg0, TArg1 arg1)

Parameters

destination ExSpan<char>

The span to which the string should be formatted.

provider IFormatProvider

An object that supplies culture-specific formatting information.

format CompositeFormat

A CompositeFormat.

charsWritten nint

The number of characters written to the span.

arg0 TArg0

The first object to format.

arg1 TArg1

The second object to format.

Returns

bool

true if the entire interpolated string could be formatted successfully; otherwise, false.

Type Parameters

TArg0

The type of the first object to format.

TArg1

The type of the second object to format.

Exceptions

ArgumentNullException

format is null.

FormatException

The index of a format item is greater than or equal to the number of supplied arguments.

TryWrite<TArg0, TArg1, TArg2>(ExSpan<char>, IFormatProvider?, CompositeFormat, out nint, TArg0, TArg1, TArg2)

Writes the CompositeFormat string to the character span, substituting the format item or items with the string representation of the corresponding arguments.

public static bool TryWrite<TArg0, TArg1, TArg2>(this ExSpan<char> destination, IFormatProvider? provider, CompositeFormat format, out nint charsWritten, TArg0 arg0, TArg1 arg1, TArg2 arg2)

Parameters

destination ExSpan<char>

The span to which the string should be formatted.

provider IFormatProvider

An object that supplies culture-specific formatting information.

format CompositeFormat

A CompositeFormat.

charsWritten nint

The number of characters written to the span.

arg0 TArg0

The first object to format.

arg1 TArg1

The second object to format.

arg2 TArg2

The third object to format.

Returns

bool

true if the entire interpolated string could be formatted successfully; otherwise, false.

Type Parameters

TArg0

The type of the first object to format.

TArg1

The type of the second object to format.

TArg2

The type of the third object to format.

Exceptions

ArgumentNullException

format is null.

FormatException

The index of a format item is greater than or equal to the number of supplied arguments.

TryWrite(ExSpan<char>, IFormatProvider?, CompositeFormat, out nint, params object?[])

Writes the CompositeFormat string to the character span, substituting the format item or items with the string representation of the corresponding arguments.

public static bool TryWrite(this ExSpan<char> destination, IFormatProvider? provider, CompositeFormat format, out nint charsWritten, params object?[] args)

Parameters

destination ExSpan<char>

The span to which the string should be formatted.

provider IFormatProvider

An object that supplies culture-specific formatting information.

format CompositeFormat

A CompositeFormat.

charsWritten nint

The number of characters written to the span.

args object[]

An array of objects to format.

Returns

bool

true if the entire interpolated string could be formatted successfully; otherwise, false.

Exceptions

ArgumentNullException

format is null.

ArgumentNullException

args is null.

FormatException

The index of a format item is greater than or equal to the number of supplied arguments.

TryWrite(ExSpan<char>, IFormatProvider?, CompositeFormat, out nint, params ReadOnlySpan<object?>)

Writes the CompositeFormat string to the character span, substituting the format item or items with the string representation of the corresponding arguments.

public static bool TryWrite(this ExSpan<char> destination, IFormatProvider? provider, CompositeFormat format, out nint charsWritten, params ReadOnlySpan<object?> args)

Parameters

destination ExSpan<char>

The span to which the string should be formatted.

provider IFormatProvider

An object that supplies culture-specific formatting information.

format CompositeFormat

A CompositeFormat.

charsWritten nint

The number of characters written to the span.

args ReadOnlySpan<object>

A ExSpan of objects to format.

Returns

bool

true if the entire interpolated string could be formatted successfully; otherwise, false.

Exceptions

ArgumentNullException

format is null.

FormatException

The index of a format item is greater than or equal to the number of supplied arguments.