Guid.TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>) Method

Definition

尝试将当前 GUID 实例格式化为所提供的字符范围。Tries to format the current GUID instance into the provided character span.

public bool TryFormat (Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default);
member this.TryFormat : Span<char> * int * ReadOnlySpan<char> -> bool
Public Function TryFormat (destination As Span(Of Char), ByRef charsWritten As Integer, Optional format As ReadOnlySpan(Of Char) = null) As Boolean

Parameters

destination
Span<Char>

此方法返回时,作为字符范围的 GUID。When this method returns, the GUID as a span of characters.

charsWritten
Int32

此方法返回时,写入范围的字符数。When this method returns, the number of characters written into the span.

format
ReadOnlySpan<Char>

包含表示以下某个说明符的字符的只读范围,指示解释 input 时要使用的确切格式:“N”、“D”、“B”、“P”或“X”。A read-only span containing the character representing one of the following specifiers that indicates the exact format to use when interpreting input: "N", "D", "B", "P", or "X".

Returns

Boolean

如果格式化操作成功,则为 true;否则为 falsetrue if the formatting operation was successful; false otherwise.

Applies to