Char.IUtf8SpanFormattable.TryFormat 方法

定义

尝试将当前实例的值格式化为 UTF-8,将其设置为提供的字节范围。

 virtual bool System.IUtf8SpanFormattable.TryFormat(Span<System::Byte> utf8Destination, [Runtime::InteropServices::Out] int % bytesWritten, ReadOnlySpan<char> format, IFormatProvider ^ provider) = IUtf8SpanFormattable::TryFormat;
bool IUtf8SpanFormattable.TryFormat (Span<byte> utf8Destination, out int bytesWritten, ReadOnlySpan<char> format, IFormatProvider provider);
abstract member System.IUtf8SpanFormattable.TryFormat : Span<byte> * int * ReadOnlySpan<char> * IFormatProvider -> bool
override this.System.IUtf8SpanFormattable.TryFormat : Span<byte> * int * ReadOnlySpan<char> * IFormatProvider -> bool
Function TryFormat (utf8Destination As Span(Of Byte), ByRef bytesWritten As Integer, format As ReadOnlySpan(Of Char), provider As IFormatProvider) As Boolean Implements IUtf8SpanFormattable.TryFormat

参数

utf8Destination
Span<Byte>

要写入此实例的值(格式为字节范围)的跨度。

bytesWritten
Int32

此方法返回时,包含写入 的 utf8Destination字节数。

format
ReadOnlySpan<Char>

一个包含字符的范围,这些字符表示定义可接受的 utf8Destination 格式的标准或自定义格式字符串。

provider
IFormatProvider

一个可选对象,提供有关 utf8Destination 的区域性特定格式设置信息。

返回

如果格式设置成功,则为 true;否则为 false

实现

适用于