Guid.IUtf8SpanFormattable.TryFormat 方法

定義

嘗試將目前實例的值格式化為 UTF-8 到提供的位元組範圍。

C#
bool IUtf8SpanFormattable.TryFormat(Span<byte> utf8Destination, out int bytesWritten, ReadOnlySpan<char> format, IFormatProvider provider);

參數

utf8Destination
Span<Byte>

要寫入這個實例值的範圍,其格式為位元組範圍。

bytesWritten
Int32

當這個方法傳回時,會包含以 utf8Destination 寫入的位元組數目。

format
ReadOnlySpan<Char>

包含字元的範圍,這些字元代表的標準或自訂格式字串能定義 utf8Destination 可接受的格式。

provider
IFormatProvider

選擇性物件,其可為 utf8Destination 提供特定的文化特性格式資訊。

傳回

若格式化成功則為 true,否則為 false

實作

適用於

產品 版本
.NET 8, 9, 10