INumberBase<TSelf>.TryParse 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| TryParse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider, TSelf) |
嘗試將UTF-8字元的範圍剖析為值。 |
| TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, TSelf) |
嘗試將字元範圍剖析成值。 |
| TryParse(String, NumberStyles, IFormatProvider, TSelf) |
嘗試將字串剖析成值。 |
TryParse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider, TSelf)
嘗試將UTF-8字元的範圍剖析為值。
public:
static override bool TryParse(ReadOnlySpan<System::Byte> utf8Text, System::Globalization::NumberStyles style, IFormatProvider ^ provider, [Runtime::InteropServices::Out] TSelf % result);
public static virtual bool TryParse(ReadOnlySpan<byte> utf8Text, System.Globalization.NumberStyles style, IFormatProvider? provider, out TSelf result);
static member TryParse : ReadOnlySpan<byte> * System.Globalization.NumberStyles * IFormatProvider * 'Self -> bool
Public Shared Overrides Function TryParse (utf8Text As ReadOnlySpan(Of Byte), style As NumberStyles, provider As IFormatProvider, ByRef result As TSelf) As Boolean
參數
- utf8Text
- ReadOnlySpan<Byte>
要剖析的UTF-8字元範圍。
- style
- NumberStyles
一個可以存在 utf8Text於 的數字樣式的位元組合。
- provider
- IFormatProvider
一個提供關於 utf8Text的文化特定格式資訊的物件。
- result
- TSelf
回傳時,包含成功解析 utf8Text 的結果,失敗時則為未定義的值。
傳回
true 若 utf8Text 成功解析;否則, false。
例外狀況
style 不是一個被支持的 NumberStyles 值。
適用於
TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, TSelf)
嘗試將字元範圍剖析成值。
public:
static bool TryParse(ReadOnlySpan<char> s, System::Globalization::NumberStyles style, IFormatProvider ^ provider, [Runtime::InteropServices::Out] TSelf % result);
public static abstract bool TryParse(ReadOnlySpan<char> s, System.Globalization.NumberStyles style, IFormatProvider? provider, out TSelf result);
static member TryParse : ReadOnlySpan<char> * System.Globalization.NumberStyles * IFormatProvider * 'Self -> bool
Public Shared Function TryParse (s As ReadOnlySpan(Of Char), style As NumberStyles, provider As IFormatProvider, ByRef result As TSelf) As Boolean
參數
- s
- ReadOnlySpan<Char>
要剖析的字元範圍。
- style
- NumberStyles
一個可以存在 s於 的數字樣式的位元組合。
- provider
- IFormatProvider
一個提供關於 s的文化特定格式資訊的物件。
- result
- TSelf
返回時,包含成功解析 s 的結果或失敗時的未定義值。
傳回
true 若 s 成功解析;否則, false。
例外狀況
style 不是一個被支持的 NumberStyles 值。
適用於
TryParse(String, NumberStyles, IFormatProvider, TSelf)
嘗試將字串剖析成值。
public:
static bool TryParse(System::String ^ s, System::Globalization::NumberStyles style, IFormatProvider ^ provider, [Runtime::InteropServices::Out] TSelf % result);
public static abstract bool TryParse(string? s, System.Globalization.NumberStyles style, IFormatProvider? provider, out TSelf result);
static member TryParse : string * System.Globalization.NumberStyles * IFormatProvider * 'Self -> bool
Public Shared Function TryParse (s As String, style As NumberStyles, provider As IFormatProvider, ByRef result As TSelf) As Boolean
參數
- s
- String
要剖析的字串。
- style
- NumberStyles
一個可以存在 s於 的數字樣式的位元組合。
- provider
- IFormatProvider
一個提供關於 s的文化特定格式資訊的物件。
- result
- TSelf
返回時,包含成功解析 s 的結果或失敗時的未定義值。
傳回
true 若 s 成功解析;否則, false。
例外狀況
style 不是一個被支持的 NumberStyles 值。