INumberBase<TSelf>.TryParse Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, TSelf) |
Tries to parse a span of characters into a value. |
TryParse(String, NumberStyles, IFormatProvider, TSelf) |
Tries to parse a string into a value. |
TryParse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider, TSelf) |
Tries to parse a span of UTF-8 characters into a value. |
TryParse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider, TSelf)
- Source:
- INumberBase.cs
- Source:
- INumberBase.cs
- Source:
- INumberBase.cs
Tries to parse a span of characters into a value.
public:
static bool TryParse(ReadOnlySpan<char> s, System::Globalization::NumberStyles style, IFormatProvider ^ provider, [Runtime::InteropServices::Out] TSelf % result);
public static abstract bool TryParse (ReadOnlySpan<char> s, System.Globalization.NumberStyles style, IFormatProvider? provider, out TSelf result);
static member TryParse : ReadOnlySpan<char> * System.Globalization.NumberStyles * IFormatProvider * 'Self -> bool
Public Shared Function TryParse (s As ReadOnlySpan(Of Char), style As NumberStyles, provider As IFormatProvider, ByRef result As TSelf) As Boolean
Parameters
- s
- ReadOnlySpan<Char>
The span of characters to parse.
- style
- NumberStyles
A bitwise combination of number styles that can be present in s
.
- provider
- IFormatProvider
An object that provides culture-specific formatting information about s
.
- result
- TSelf
On return, contains the result of succesfully parsing s
or an undefined value on failure.
Returns
true
if s
was successfully parsed; otherwise, false
.
Exceptions
style
is not a supported NumberStyles value.
Applies to
TryParse(String, NumberStyles, IFormatProvider, TSelf)
- Source:
- INumberBase.cs
- Source:
- INumberBase.cs
- Source:
- INumberBase.cs
Tries to parse a string into a value.
public:
static bool TryParse(System::String ^ s, System::Globalization::NumberStyles style, IFormatProvider ^ provider, [Runtime::InteropServices::Out] TSelf % result);
public static abstract bool TryParse (string? s, System.Globalization.NumberStyles style, IFormatProvider? provider, out TSelf result);
static member TryParse : string * System.Globalization.NumberStyles * IFormatProvider * 'Self -> bool
Public Shared Function TryParse (s As String, style As NumberStyles, provider As IFormatProvider, ByRef result As TSelf) As Boolean
Parameters
- s
- String
The string to parse.
- style
- NumberStyles
A bitwise combination of number styles that can be present in s
.
- provider
- IFormatProvider
An object that provides culture-specific formatting information about s
.
- result
- TSelf
On return, contains the result of succesfully parsing s
or an undefined value on failure.
Returns
true
if s
was successfully parsed; otherwise, false
.
Exceptions
style
is not a supported NumberStyles value.
Applies to
TryParse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider, TSelf)
- Source:
- INumberBase.cs
- Source:
- INumberBase.cs
Tries to parse a span of UTF-8 characters into a value.
public:
static override bool TryParse(ReadOnlySpan<System::Byte> utf8Text, System::Globalization::NumberStyles style, IFormatProvider ^ provider, [Runtime::InteropServices::Out] TSelf % result);
public static virtual bool TryParse (ReadOnlySpan<byte> utf8Text, System.Globalization.NumberStyles style, IFormatProvider? provider, out TSelf result);
static member TryParse : ReadOnlySpan<byte> * System.Globalization.NumberStyles * IFormatProvider * 'Self -> bool
Public Shared Overrides Function TryParse (utf8Text As ReadOnlySpan(Of Byte), style As NumberStyles, provider As IFormatProvider, ByRef result As TSelf) As Boolean
Parameters
- utf8Text
- ReadOnlySpan<Byte>
The span of UTF-8 characters to parse.
- style
- NumberStyles
A bitwise combination of number styles that can be present in utf8Text
.
- provider
- IFormatProvider
An object that provides culture-specific formatting information about utf8Text
.
- result
- TSelf
On return, contains the result of successfully parsing utf8Text
or an undefined value on failure.
Returns
true
if utf8Text
was successfully parsed; otherwise, false
.
Exceptions
style
is not a supported NumberStyles value.