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
destinationExSpan<char>The span to which the interpolated string should be formatted.
handlerExTryWriteInterpolatedStringHandlerThe interpolated string.
charsWrittennintThe 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
destinationExSpan<char>The span to which the interpolated string should be formatted.
providerIFormatProviderAn object that supplies culture-specific formatting information.
handlerExTryWriteInterpolatedStringHandlerThe interpolated string.
charsWrittennintThe 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
destinationExSpan<char>The span to which the string should be formatted.
providerIFormatProviderAn object that supplies culture-specific formatting information.
formatCompositeFormatcharsWrittennintThe number of characters written to the span.
arg0TArg0The first object to format.
Returns
Type Parameters
TArg0The type of the first object to format.
Exceptions
- ArgumentNullException
formatis 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
destinationExSpan<char>The span to which the string should be formatted.
providerIFormatProviderAn object that supplies culture-specific formatting information.
formatCompositeFormatcharsWrittennintThe number of characters written to the span.
arg0TArg0The first object to format.
arg1TArg1The second object to format.
Returns
Type Parameters
TArg0The type of the first object to format.
TArg1The type of the second object to format.
Exceptions
- ArgumentNullException
formatis 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
destinationExSpan<char>The span to which the string should be formatted.
providerIFormatProviderAn object that supplies culture-specific formatting information.
formatCompositeFormatcharsWrittennintThe number of characters written to the span.
arg0TArg0The first object to format.
arg1TArg1The second object to format.
arg2TArg2The third object to format.
Returns
Type Parameters
TArg0The type of the first object to format.
TArg1The type of the second object to format.
TArg2The type of the third object to format.
Exceptions
- ArgumentNullException
formatis 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
destinationExSpan<char>The span to which the string should be formatted.
providerIFormatProviderAn object that supplies culture-specific formatting information.
formatCompositeFormatcharsWrittennintThe number of characters written to the span.
argsobject[]An array of objects to format.
Returns
Exceptions
- ArgumentNullException
formatis null.- ArgumentNullException
argsis 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
destinationExSpan<char>The span to which the string should be formatted.
providerIFormatProviderAn object that supplies culture-specific formatting information.
formatCompositeFormatcharsWrittennintThe number of characters written to the span.
argsReadOnlySpan<object>A ExSpan of objects to format.
Returns
Exceptions
- ArgumentNullException
formatis null.- FormatException
The index of a format item is greater than or equal to the number of supplied arguments.