IntPtr.TryParse 方法

定義

多載

名稱 Description
TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, IntPtr)

將指定樣式和特定文化特性格式之數位的唯讀字元表示範圍轉換為其帶正負號的原生整數對等。 傳回值表示轉換是否成功。

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, NumberStyles, IFormatProvider, IntPtr)

將指定樣式和特定文化特性格式之數位的字串表示,轉換為其相等的帶正負號原生整數。 傳回值表示轉換是否成功。

TryParse(String, IFormatProvider, IntPtr)

嘗試將字串剖析成值。

TryParse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider, IntPtr)

嘗試將UTF-8字元的範圍剖析為值。

TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, IntPtr)

來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs

將指定樣式和特定文化特性格式之數位的唯讀字元表示範圍轉換為其帶正負號的原生整數對等。 傳回值表示轉換是否成功。

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, [Runtime::InteropServices::Out] IntPtr % result);
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,則轉換失敗。 這個參數會未初始化傳遞;將覆寫原本在結果中提供的任何值。

傳回

trues成功轉換;否則,。 false

適用於

TryParse(ReadOnlySpan<Byte>, IntPtr)

來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
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 數字;若轉換失敗則為零。 這個參數會未初始化傳遞;將覆寫原本在結果中提供的任何值。

傳回

trueutf8Text成功轉換;否則,。 false

適用於

TryParse(ReadOnlySpan<Char>, IntPtr)

來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
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,則轉換失敗。 這個參數會未初始化傳遞;將覆寫原本在結果中提供的任何值。

傳回

trues成功轉換;否則,。 false

適用於

TryParse(String, IntPtr)

來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
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的數字,轉換即告失敗。 這個參數會未初始化傳遞;將覆寫原本在結果中提供的任何值。

傳回

trues成功轉換;否則,。 false

適用於

TryParse(ReadOnlySpan<Byte>, IFormatProvider, IntPtr)

來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
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 的結果,失敗時則為未定義的值。

傳回

trueutf8Text 成功解析;否則, false

適用於

TryParse(ReadOnlySpan<Char>, IFormatProvider, IntPtr)

來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
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 的結果,或失敗時為未定義的值。

傳回

trues成功轉換;否則,。 false

適用於

TryParse(String, NumberStyles, IFormatProvider, IntPtr)

來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
IntPtr.cs

將指定樣式和特定文化特性格式之數位的字串表示,轉換為其相等的帶正負號原生整數。 傳回值表示轉換是否成功。

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(System::String ^ s, System::Globalization::NumberStyles style, IFormatProvider ^ provider, [Runtime::InteropServices::Out] IntPtr % result);
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的數字,轉換即告失敗。 這個參數會未初始化傳遞;將覆寫原本在結果中提供的任何值。

傳回

trues成功轉換;否則,。 false

適用於

TryParse(String, IFormatProvider, IntPtr)

來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
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 的結果,或失敗時為未定義的值。

傳回

trues 成功解析;否則, false

適用於

TryParse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider, IntPtr)

來源:
IntPtr.cs
來源:
IntPtr.cs
來源:
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 的結果,失敗時則為未定義的值。

傳回

trueutf8Text 成功解析;否則, false

適用於