IntPtr.TryParse Method

Definition

Overloads

TryParse(String, NumberStyles, IFormatProvider, IntPtr)

Converts the string representation of a number in a specified style and culture-specific format to its signed native integer equivalent. A return value indicates whether the conversion succeeded.

TryParse(String, IntPtr)

Converts the string representation of a number to its signed native integer equivalent. A return value indicates whether the conversion succeeded.

TryParse(String, NumberStyles, IFormatProvider, IntPtr)

Converts the string representation of a number in a specified style and culture-specific format to its signed native integer equivalent. A return value indicates whether the conversion succeeded.

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

Parameters

s
String

A string containing a number to convert. The string is interpreted using the style specified by style.

style
NumberStyles

A bitwise combination of enumeration values that indicates the style elements that can be present in s.

provider
IFormatProvider

An object that supplies culture-specific formatting information about s.

result
IntPtr

When this method returns, contains the signed native integer value equivalent of the number contained in s, if the conversion succeeded, or zero if the conversion failed. The conversion fails if the s parameter is null or Empty, is not of the correct format, or represents a number less than MinValue or greater than MaxValue. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.

Returns

Boolean

true if s was converted successfully; otherwise, false.

Applies to

TryParse(String, IntPtr)

Converts the string representation of a number to its signed native integer equivalent. A return value indicates whether the conversion succeeded.

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

Parameters

s
String

A string containing a number to convert.

result
IntPtr

When this method returns, contains the signed native integer value equivalent of the number contained in s, if the conversion succeeded, or zero if the conversion failed. The conversion fails if the s parameter is null or Empty, is not of the correct format, or represents a number less than MinValue or greater than MaxValue. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.

Returns

Boolean

true if s was converted successfully; otherwise, false.

Applies to