IntPtr.TryParse Método

Definição

Sobrecargas

TryParse(String, NumberStyles, IFormatProvider, IntPtr)

Converte a representação de cadeia de caracteres de um número em um formato indicado específico de estilo e cultura no seu inteiro nativo com sinal equivalente.Converts the string representation of a number in a specified style and culture-specific format to its signed native integer equivalent. Um valor retornado indica se a conversão foi bem-sucedida.A return value indicates whether the conversion succeeded.

TryParse(String, IntPtr)

Converte a representação da cadeia de caracteres de um número no inteiro nativo com sinal equivalente.Converts the string representation of a number to its signed native integer equivalent. Um valor retornado indica se a conversão foi bem-sucedida.A return value indicates whether the conversion succeeded.

TryParse(String, NumberStyles, IFormatProvider, IntPtr)

Converte a representação de cadeia de caracteres de um número em um formato indicado específico de estilo e cultura no seu inteiro nativo com sinal equivalente.Converts the string representation of a number in a specified style and culture-specific format to its signed native integer equivalent. Um valor retornado indica se a conversão foi bem-sucedida.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

Parâmetros

s
String

Uma cadeia de caracteres que contém um número a ser convertido.A string containing a number to convert. A cadeia de caracteres é interpretada usando o estilo especificado por style.The string is interpreted using the style specified by style.

style
NumberStyles

Um combinação bit a bit de valores de enumeração que indica os elementos de estilo que podem estar presentes em s.A bitwise combination of enumeration values that indicates the style elements that can be present in s.

provider
IFormatProvider

Um objeto que fornece informações de formatação específicas da cultura sobre s.An object that supplies culture-specific formatting information about s.

result
IntPtr

Quando esse método retornar, conterá o valor inteiro nativo com sinal equivalente do número contido em s, se a conversão tiver sido bem-sucedida, ou zero, se a conversão tiver falhado.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. A conversão falhará se o parâmetro s for null ou vazio, não estiver em um formato correto ou representar um número menor que MinValue ou maior que MaxValue.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. Este parâmetro é passado não inicializado; qualquer valor fornecido originalmente no resultado será substituído.This parameter is passed uninitialized; any value originally supplied in result will be overwritten.

Retornos

Boolean

true caso s tenha sido convertido com êxito; do contrário, false.true if s was converted successfully; otherwise, false.

Aplica-se a

TryParse(String, IntPtr)

Converte a representação da cadeia de caracteres de um número no inteiro nativo com sinal equivalente.Converts the string representation of a number to its signed native integer equivalent. Um valor retornado indica se a conversão foi bem-sucedida.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

Parâmetros

s
String

Uma cadeia de caracteres que contém um número a ser convertido.A string containing a number to convert.

result
IntPtr

Quando esse método retornar, conterá o valor inteiro nativo com sinal equivalente do número contido em s, se a conversão tiver sido bem-sucedida, ou zero, se a conversão tiver falhado.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. A conversão falhará se o parâmetro s for null ou vazio, não estiver em um formato correto ou representar um número menor que MinValue ou maior que MaxValue.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. Este parâmetro é passado não inicializado; qualquer valor fornecido originalmente no resultado será substituído.This parameter is passed uninitialized; any value originally supplied in result will be overwritten.

Retornos

Boolean

true caso s tenha sido convertido com êxito; do contrário, false.true if s was converted successfully; otherwise, false.

Aplica-se a