共用方式為


SByte.TryFormat 方法

定義

多載

TryFormat(Span<Byte>, Int32, ReadOnlySpan<Char>, IFormatProvider)

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

TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider)

嘗試將目前8位帶正負號整數實例的值格式化為提供的字元範圍。

TryFormat(Span<Byte>, Int32, ReadOnlySpan<Char>, IFormatProvider)

來源:
SByte.cs
來源:
SByte.cs

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

public bool TryFormat (Span<byte> utf8Destination, out int bytesWritten, ReadOnlySpan<char> format = default, IFormatProvider? provider = default);
abstract member TryFormat : Span<byte> * int * ReadOnlySpan<char> * IFormatProvider -> bool
override this.TryFormat : Span<byte> * int * ReadOnlySpan<char> * IFormatProvider -> bool
Public Function TryFormat (utf8Destination As Span(Of Byte), ByRef bytesWritten As Integer, Optional format As ReadOnlySpan(Of Char) = Nothing, Optional provider As IFormatProvider = Nothing) As Boolean

參數

utf8Destination
Span<Byte>

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

bytesWritten
Int32

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

format
ReadOnlySpan<Char>

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

provider
IFormatProvider

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

傳回

如果格式設定成功,true;否則,false

實作

適用於

TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider)

來源:
SByte.cs
來源:
SByte.cs
來源:
SByte.cs

嘗試將目前8位帶正負號整數實例的值格式化為提供的字元範圍。

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

參數

destination
Span<Char>

寫入這個實例值的範圍,格式為字元範圍。

charsWritten
Int32

當這個方法傳回時,會包含以 destination撰寫的字元數。

format
ReadOnlySpan<Char>

範圍,包含代表標準或自定義格式字串的字元,定義 destination可接受的格式。

provider
IFormatProvider

選擇性物件,提供 destination的特定文化特性格式資訊。

傳回

如果格式設定成功,true;否則,false

實作

另請參閱

適用於