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) |
将指定样式和区域性特定格式的数字的字符串表示形式转换为它的等效有符号本机整数。 一个指示转换是否成功的返回值。 |
TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, IntPtr) |
将指定样式和区域性特定格式的数字的只读字符表示形式转换为其等效的带符号本机整数。 一个指示转换是否成功的返回值。 |
TryParse(ReadOnlySpan<Byte>, IntPtr)
- Source:
- IntPtr.cs
- Source:
- 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
数字的带符号整数值;如果转换失败,则包含零。 此参数未经初始化即进行传递;最初在 result 中提供的任何值都会被覆盖。
返回
如果 true
成功转换,则为 utf8Text
;否则为 false
。
适用于
TryParse(ReadOnlySpan<Char>, IntPtr)
- Source:
- IntPtr.cs
- Source:
- IntPtr.cs
- Source:
- 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的数字,则转换失败。 此参数未经初始化即进行传递;最初在 result 中提供的任何值都会被覆盖。
返回
如果 true
成功转换,则为 s
;否则为 false
。
适用于
TryParse(String, IntPtr)
- Source:
- IntPtr.cs
- Source:
- IntPtr.cs
- Source:
- 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的数字,则转换失败。 此参数未经初始化即进行传递;最初在 result 中提供的任何值都会被覆盖。
返回
如果 true
成功转换,则为 s
;否则为 false
。
适用于
TryParse(ReadOnlySpan<Byte>, IFormatProvider, IntPtr)
- Source:
- IntPtr.cs
- Source:
- 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)
- Source:
- IntPtr.cs
- Source:
- IntPtr.cs
- Source:
- 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
的结果或失败时的未定义值。
返回
如果 true
成功转换,则为 s
;否则为 false
。
适用于
TryParse(String, IFormatProvider, IntPtr)
- Source:
- IntPtr.cs
- Source:
- IntPtr.cs
- Source:
- 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)
- Source:
- IntPtr.cs
- Source:
- 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)
- Source:
- IntPtr.cs
- Source:
- IntPtr.cs
- Source:
- IntPtr.cs
将指定样式和区域性特定格式的数字的字符串表示形式转换为它的等效有符号本机整数。 一个指示转换是否成功的返回值。
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的数字,则转换失败。 此参数未经初始化即进行传递;最初在 result 中提供的任何值都会被覆盖。
返回
如果 true
成功转换,则为 s
;否则为 false
。
适用于
TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, IntPtr)
- Source:
- IntPtr.cs
- Source:
- IntPtr.cs
- Source:
- 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的数字,则转换失败。 此参数未经初始化即进行传递;最初在 result 中提供的任何值都会被覆盖。
返回
如果 true
成功转换,则为 s
;否则为 false
。
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈