Method TryWrite
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
ExTryWriteInterpolatedStringHandlerThe interpolated string.
charsWritten
nintThe 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
IFormatProviderAn object that supplies culture-specific formatting information.
handler
ExTryWriteInterpolatedStringHandlerThe interpolated string.
charsWritten
nintThe 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
IFormatProviderAn object that supplies culture-specific formatting information.
format
CompositeFormatcharsWritten
nintThe number of characters written to the span.
arg0
TArg0The first object to format.
Returns
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
IFormatProviderAn object that supplies culture-specific formatting information.
format
CompositeFormatcharsWritten
nintThe number of characters written to the span.
arg0
TArg0The first object to format.
arg1
TArg1The second object to format.
Returns
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
IFormatProviderAn object that supplies culture-specific formatting information.
format
CompositeFormatcharsWritten
nintThe number of characters written to the span.
arg0
TArg0The first object to format.
arg1
TArg1The second object to format.
arg2
TArg2The third object to format.
Returns
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
IFormatProviderAn object that supplies culture-specific formatting information.
format
CompositeFormatcharsWritten
nintThe number of characters written to the span.
args
object[]An array of objects to format.
Returns
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
IFormatProviderAn object that supplies culture-specific formatting information.
format
CompositeFormatcharsWritten
nintThe number of characters written to the span.
args
ReadOnlySpan<object>A ExSpan of objects to format.
Returns
Exceptions
- ArgumentNullException
format
is null.- FormatException
The index of a format item is greater than or equal to the number of supplied arguments.