IntPtr.TryParse 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
TryParse(ReadOnlySpan<Byte>, IntPtr) |
嘗試將包含數位字串表示的 UTF-8 字元範圍轉換為其相等帶正負號的整數。 |
TryParse(ReadOnlySpan<Char>, IntPtr) |
將數位之字元表示的唯讀範圍轉換為其帶正負號的原生整數對等專案。 傳回指示轉換是否成功的值。 |
TryParse(String, IntPtr) |
將數字的字串表示轉換成其對等帶正負號的原生整數。 傳回指示轉換是否成功的值。 |
TryParse(ReadOnlySpan<Byte>, IFormatProvider, IntPtr) |
嘗試將 UTF-8 字元的範圍剖析為值。 |
TryParse(ReadOnlySpan<Char>, IFormatProvider, IntPtr) |
嘗試將字串剖析成值。 |
TryParse(String, IFormatProvider, IntPtr) |
嘗試將字串剖析成值。 |
TryParse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider, IntPtr) |
嘗試將 UTF-8 字元的範圍剖析為值。 |
TryParse(String, NumberStyles, IFormatProvider, IntPtr) |
將指定樣式與文化特性 (Culture) 特定格式之數字的字串表示法轉換成其對等帶正負號的原生整數。 傳回指示轉換是否成功的值。 |
TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, IntPtr) |
將指定樣式和文化特性特定格式之數位字元表示的唯讀範圍,轉換為其帶正負號的原生整數對等專案。 傳回指示轉換是否成功的值。 |
TryParse(ReadOnlySpan<Byte>, IntPtr)
- 來源:
- IntPtr.cs
- 來源:
- IntPtr.cs
嘗試將包含數位字串表示的 UTF-8 字元範圍轉換為其相等帶正負號的整數。
public:
static bool TryParse(ReadOnlySpan<System::Byte> utf8Text, [Runtime::InteropServices::Out] IntPtr % result);
public static bool TryParse (ReadOnlySpan<byte> utf8Text, out IntPtr result);
static member TryParse : ReadOnlySpan<byte> * nativeint -> bool
Public Shared Function TryParse (utf8Text As ReadOnlySpan(Of Byte), ByRef result As IntPtr) As Boolean
參數
- utf8Text
- ReadOnlySpan<Byte>
範圍,包含代表要轉換之數位的 UTF-8 字元。
- result
-
IntPtr
nativeint
當這個方法傳回時,會包含與轉換成功時所包含的 utf8Text
數位相等的帶正負號整數值,如果轉換失敗則為零。 此參數會以未初始化的狀態來傳遞,並會覆寫任何原本在結果中提供的值。
傳回
如果 utf8Text
轉換成功,則為 true
,否則為 false
。
適用於
TryParse(ReadOnlySpan<Char>, IntPtr)
- 來源:
- IntPtr.cs
- 來源:
- IntPtr.cs
- 來源:
- IntPtr.cs
將數位之字元表示的唯讀範圍轉換為其帶正負號的原生整數對等專案。 傳回指示轉換是否成功的值。
public:
static bool TryParse(ReadOnlySpan<char> s, [Runtime::InteropServices::Out] IntPtr % result);
public static bool TryParse (ReadOnlySpan<char> s, out IntPtr result);
static member TryParse : ReadOnlySpan<char> * nativeint -> bool
Public Shared Function TryParse (s As ReadOnlySpan(Of Char), ByRef result As IntPtr) As Boolean
參數
- s
- ReadOnlySpan<Char>
包含要轉換之數位的唯讀字元範圍。
- result
-
IntPtr
nativeint
當這個方法傳回時,如果轉換成功,則包含與 中所 s
包含數位相等的帶正負號原生整數,如果轉換失敗則為零。 如果 s
參數是空的、不是正確的格式,或代表小於 MinValue 或大於 MaxValue 的數位,轉換就會失敗。 此參數會以未初始化的狀態來傳遞,並會覆寫任何原本在結果中提供的值。
傳回
如果 s
轉換成功,則為 true
,否則為 false
。
適用於
TryParse(String, IntPtr)
- 來源:
- IntPtr.cs
- 來源:
- IntPtr.cs
- 來源:
- IntPtr.cs
將數字的字串表示轉換成其對等帶正負號的原生整數。 傳回指示轉換是否成功的值。
public:
static bool TryParse(System::String ^ s, [Runtime::InteropServices::Out] IntPtr % result);
public static bool TryParse (string? s, out IntPtr result);
static member TryParse : string * nativeint -> bool
Public Shared Function TryParse (s As String, ByRef result As IntPtr) As Boolean
參數
- s
- String
字串,包含要轉換的數字。
- result
-
IntPtr
nativeint
當這個方法傳回時,如果轉換成功,則包含相當於 s
中所包含數值之帶正負號的原生整數值;如果轉換失敗,則為零。 如果 s
參數為 null
或空白、不是正確的格式,或代表小於 MinValue 或大於 MaxValue 的數位,則轉換會失敗。 此參數會以未初始化的狀態來傳遞,並會覆寫任何原本在結果中提供的值。
傳回
如果 s
轉換成功,則為 true
,否則為 false
。
適用於
TryParse(ReadOnlySpan<Byte>, IFormatProvider, IntPtr)
- 來源:
- IntPtr.cs
- 來源:
- IntPtr.cs
嘗試將 UTF-8 字元的範圍剖析為值。
public:
static bool TryParse(ReadOnlySpan<System::Byte> utf8Text, IFormatProvider ^ provider, [Runtime::InteropServices::Out] IntPtr % result) = IUtf8SpanParsable<IntPtr>::TryParse;
public static bool TryParse (ReadOnlySpan<byte> utf8Text, IFormatProvider? provider, out IntPtr result);
static member TryParse : ReadOnlySpan<byte> * IFormatProvider * nativeint -> bool
Public Shared Function TryParse (utf8Text As ReadOnlySpan(Of Byte), provider As IFormatProvider, ByRef result As IntPtr) As Boolean
參數
- utf8Text
- ReadOnlySpan<Byte>
要剖析的 UTF-8 字元範圍。
- provider
- IFormatProvider
提供關於 utf8Text
之特定文化特性格式資訊的物件。
- result
-
IntPtr
nativeint
傳回時,包含成功剖析 utf8Text
或失敗時未定義值的結果。
傳回
true
如果 utf8Text
已成功剖析,則為 ,否則為 false
。
適用於
TryParse(ReadOnlySpan<Char>, IFormatProvider, IntPtr)
- 來源:
- IntPtr.cs
- 來源:
- IntPtr.cs
- 來源:
- IntPtr.cs
嘗試將字串剖析成值。
public:
static bool TryParse(ReadOnlySpan<char> s, IFormatProvider ^ provider, [Runtime::InteropServices::Out] IntPtr % result) = ISpanParsable<IntPtr>::TryParse;
public static bool TryParse (ReadOnlySpan<char> s, IFormatProvider? provider, out IntPtr result);
static member TryParse : ReadOnlySpan<char> * IFormatProvider * nativeint -> bool
Public Shared Function TryParse (s As ReadOnlySpan(Of Char), provider As IFormatProvider, ByRef result As IntPtr) As Boolean
參數
- s
- ReadOnlySpan<Char>
包含要轉換之數位的唯讀字元範圍。
- provider
- IFormatProvider
提供關於 s
之特定文化特性格式資訊的物件。
- result
-
IntPtr
nativeint
當這個方法傳回時,包含成功剖析 s
或失敗時未定義值的結果。
傳回
如果 s
轉換成功,則為 true
,否則為 false
。
適用於
TryParse(String, IFormatProvider, IntPtr)
- 來源:
- IntPtr.cs
- 來源:
- IntPtr.cs
- 來源:
- IntPtr.cs
嘗試將字串剖析成值。
public:
static bool TryParse(System::String ^ s, IFormatProvider ^ provider, [Runtime::InteropServices::Out] IntPtr % result) = IParsable<IntPtr>::TryParse;
public static bool TryParse (string? s, IFormatProvider? provider, out IntPtr result);
static member TryParse : string * IFormatProvider * nativeint -> bool
Public Shared Function TryParse (s As String, provider As IFormatProvider, ByRef result As IntPtr) As Boolean
參數
- s
- String
要剖析的字串。
- provider
- IFormatProvider
提供關於 s
之特定文化特性格式資訊的物件。
- result
-
IntPtr
nativeint
當這個方法傳回時,包含成功剖析 s
或失敗時未定義值的結果。
傳回
true
如果 s
已成功剖析,則為 ,否則為 false
。
適用於
TryParse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider, IntPtr)
- 來源:
- IntPtr.cs
- 來源:
- IntPtr.cs
嘗試將 UTF-8 字元的範圍剖析為值。
public:
static bool TryParse(ReadOnlySpan<System::Byte> utf8Text, System::Globalization::NumberStyles style, IFormatProvider ^ provider, [Runtime::InteropServices::Out] IntPtr % result) = System::Numerics::INumberBase<IntPtr>::TryParse;
public static bool TryParse (ReadOnlySpan<byte> utf8Text, System.Globalization.NumberStyles style, IFormatProvider? provider, out IntPtr result);
static member TryParse : ReadOnlySpan<byte> * System.Globalization.NumberStyles * IFormatProvider * nativeint -> bool
Public Shared Function TryParse (utf8Text As ReadOnlySpan(Of Byte), style As NumberStyles, provider As IFormatProvider, ByRef result As IntPtr) As Boolean
參數
- utf8Text
- ReadOnlySpan<Byte>
要剖析的 UTF-8 字元範圍。
- style
- NumberStyles
數位樣式的位元組合,可以存在於 中 utf8Text
。
- provider
- IFormatProvider
提供關於 utf8Text
之特定文化特性格式資訊的物件。
- result
-
IntPtr
nativeint
傳回時,包含成功剖析 utf8Text
或失敗時未定義值的結果。
傳回
true
如果 utf8Text
已成功剖析,則為 ,否則為 false
。
適用於
TryParse(String, NumberStyles, IFormatProvider, IntPtr)
- 來源:
- IntPtr.cs
- 來源:
- IntPtr.cs
- 來源:
- IntPtr.cs
將指定樣式與文化特性 (Culture) 特定格式之數字的字串表示法轉換成其對等帶正負號的原生整數。 傳回指示轉換是否成功的值。
public:
static bool TryParse(System::String ^ s, System::Globalization::NumberStyles style, IFormatProvider ^ provider, [Runtime::InteropServices::Out] IntPtr % result);
public:
static bool TryParse(System::String ^ s, System::Globalization::NumberStyles style, IFormatProvider ^ provider, [Runtime::InteropServices::Out] IntPtr % result) = System::Numerics::INumberBase<IntPtr>::TryParse;
public static bool TryParse (string? s, System.Globalization.NumberStyles style, IFormatProvider? provider, out IntPtr result);
static member TryParse : string * System.Globalization.NumberStyles * IFormatProvider * nativeint -> bool
Public Shared Function TryParse (s As String, style As NumberStyles, provider As IFormatProvider, ByRef result As IntPtr) As Boolean
參數
- s
- String
字串,包含要轉換的數字。 這個字串使用 style
指定的樣式來解譯。
- style
- NumberStyles
列舉值的位元組合,表示 s
中可以存在的樣式項目。
- provider
- IFormatProvider
物件,其提供關於 s
的特定文化特性格式資訊。
- result
-
IntPtr
nativeint
當這個方法傳回時,如果轉換成功,則包含相當於 s
中所包含數值之帶正負號的原生整數值;如果轉換失敗,則為零。 如果 s
參數為 null
或空白、不是正確的格式,或代表小於 MinValue 或大於 MaxValue 的數位,則轉換會失敗。 此參數會以未初始化的狀態來傳遞,並會覆寫任何原本在結果中提供的值。
傳回
如果 s
轉換成功,則為 true
,否則為 false
。
適用於
TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, IntPtr)
- 來源:
- IntPtr.cs
- 來源:
- IntPtr.cs
- 來源:
- IntPtr.cs
將指定樣式和文化特性特定格式之數位字元表示的唯讀範圍,轉換為其帶正負號的原生整數對等專案。 傳回指示轉換是否成功的值。
public:
static bool TryParse(ReadOnlySpan<char> s, System::Globalization::NumberStyles style, IFormatProvider ^ provider, [Runtime::InteropServices::Out] IntPtr % result);
public:
static bool TryParse(ReadOnlySpan<char> s, System::Globalization::NumberStyles style, IFormatProvider ^ provider, [Runtime::InteropServices::Out] IntPtr % result) = System::Numerics::INumberBase<IntPtr>::TryParse;
public static bool TryParse (ReadOnlySpan<char> s, System.Globalization.NumberStyles style, IFormatProvider? provider, out IntPtr result);
static member TryParse : ReadOnlySpan<char> * System.Globalization.NumberStyles * IFormatProvider * nativeint -> bool
Public Shared Function TryParse (s As ReadOnlySpan(Of Char), style As NumberStyles, provider As IFormatProvider, ByRef result As IntPtr) As Boolean
參數
- s
- ReadOnlySpan<Char>
包含要轉換之數位的唯讀字元範圍。 這個字串使用 style
指定的樣式來解譯。
- style
- NumberStyles
列舉值的位元組合,表示 s
中可以存在的樣式項目。
- provider
- IFormatProvider
物件,其提供關於 s
的特定文化特性格式資訊。
- result
-
IntPtr
nativeint
當這個方法傳回時,如果轉換成功,則包含相當於 s
中所包含數值之帶正負號的原生整數值;如果轉換失敗,則為零。 如果 s
參數是空的、不是正確的格式,或代表小於 MinValue 或大於 MaxValue 的數位,轉換就會失敗。 此參數會以未初始化的狀態來傳遞,並會覆寫任何原本在結果中提供的值。
傳回
如果 s
轉換成功,則為 true
,否則為 false
。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應