Half.Parse Method
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.
Parse(String) |
Converts the string representation of a number to its half-precision floating-point number equivalent. |
Parse(ReadOnlySpan<Byte>, IFormatProvider) |
Parses a span of UTF-8 characters into a value. |
Parse(ReadOnlySpan<Char>, IFormatProvider) |
Parses a span of characters into a value. |
Parse(String, NumberStyles) |
Converts the string representation of a number in a specified style to its single-precision floating-point number equivalent. |
Parse(String, IFormatProvider) |
Converts the string representation of a number in a specified culture-specific format to its single-precision floating-point number equivalent. |
Parse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider) |
Parses a span of UTF-8 characters into a value. |
Parse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider) |
Converts the string representation of a number in a specified style and culture-specific format to its single-precision floating-point number equivalent. |
Parse(String, NumberStyles, IFormatProvider) |
Converts the string representation of a number in a specified style and culture-specific format to its single-precision floating-point number equivalent. |
- Source:
- Half.cs
- Source:
- Half.cs
- Source:
- Half.cs
Converts the string representation of a number to its half-precision floating-point number equivalent.
public:
static Half Parse(System::String ^ s);
public static Half Parse (string s);
static member Parse : string -> Half
Public Shared Function Parse (s As String) As Half
Parameters
- s
- String
A string that contains a number to convert.
Returns
A half-precision floating-point number equivalent to the numeric value or symbol specified in s
.
Exceptions
s
is null
.
s
does not represent a number in a valid format.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | 5, 6, 7, 8, 9 |
- Source:
- Half.cs
- Source:
- Half.cs
Parses a span of UTF-8 characters into a value.
public:
static Half Parse(ReadOnlySpan<System::Byte> utf8Text, IFormatProvider ^ provider) = IUtf8SpanParsable<Half>::Parse;
public static Half Parse (ReadOnlySpan<byte> utf8Text, IFormatProvider? provider);
static member Parse : ReadOnlySpan<byte> * IFormatProvider -> Half
Public Shared Function Parse (utf8Text As ReadOnlySpan(Of Byte), provider As IFormatProvider) As Half
Parameters
- utf8Text
- ReadOnlySpan<Byte>
The span of UTF-8 characters to parse.
- provider
- IFormatProvider
An object that provides culture-specific formatting information about utf8Text
.
Returns
The result of parsing utf8Text
.
Implements
Applies to
.NET 9 and .NET 8
Product | Versions |
---|---|
.NET | 8, 9 |
- Source:
- Half.cs
- Source:
- Half.cs
- Source:
- Half.cs
Parses a span of characters into a value.
public:
static Half Parse(ReadOnlySpan<char> s, IFormatProvider ^ provider) = ISpanParsable<Half>::Parse;
public static Half Parse (ReadOnlySpan<char> s, IFormatProvider? provider);
static member Parse : ReadOnlySpan<char> * IFormatProvider -> Half
Public Shared Function Parse (s As ReadOnlySpan(Of Char), provider As IFormatProvider) As Half
Parameters
- s
- ReadOnlySpan<Char>
The span of characters to parse.
- provider
- IFormatProvider
An object that provides culture-specific formatting information about s
.
Returns
The result of parsing s
.
Implements
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | 7, 8, 9 |
- Source:
- Half.cs
- Source:
- Half.cs
- Source:
- Half.cs
Converts the string representation of a number in a specified style to its single-precision floating-point number equivalent.
public:
static Half Parse(System::String ^ s, System::Globalization::NumberStyles style);
public static Half Parse (string s, System.Globalization.NumberStyles style);
static member Parse : string * System.Globalization.NumberStyles -> Half
Public Shared Function Parse (s As String, style As NumberStyles) As Half
Parameters
- s
- String
A string that contains a number to convert.
- style
- NumberStyles
A bitwise combination of enumeration values that indicates the style elements that can be present in s
.
Returns
A half-precision floating-point number equivalent to the numeric value or symbol specified in s
.
Exceptions
s
is null
.
s
does not represent a number in a valid format.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | 5, 6, 7, 8, 9 |
- Source:
- Half.cs
- Source:
- Half.cs
- Source:
- Half.cs
Converts the string representation of a number in a specified culture-specific format to its single-precision floating-point number equivalent.
public:
static Half Parse(System::String ^ s, IFormatProvider ^ provider);
public:
static Half Parse(System::String ^ s, IFormatProvider ^ provider) = IParsable<Half>::Parse;
public static Half Parse (string s, IFormatProvider? provider);
static member Parse : string * IFormatProvider -> Half
Public Shared Function Parse (s As String, provider As IFormatProvider) As Half
Parameters
- s
- String
A string that contains a number to convert.
- provider
- IFormatProvider
An object that supplies culture-specific formatting information about s
.
Returns
A half-precision floating-point number equivalent to the numeric value or symbol specified in s
.
Implements
Exceptions
s
is null
.
s
does not represent a number in a valid format.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | 5, 6, 7, 8, 9 |
- Source:
- Half.cs
- Source:
- Half.cs
Parses a span of UTF-8 characters into a value.
public static Half Parse (ReadOnlySpan<byte> utf8Text, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.Float, IFormatProvider? provider = default);
static member Parse : ReadOnlySpan<byte> * System.Globalization.NumberStyles * IFormatProvider -> Half
Public Shared Function Parse (utf8Text As ReadOnlySpan(Of Byte), Optional style As NumberStyles = System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.Float, Optional provider As IFormatProvider = Nothing) As Half
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
.
Returns
The result of parsing utf8Text
.
Implements
Applies to
.NET 9 and .NET 8
Product | Versions |
---|---|
.NET | 8, 9 |
- Source:
- Half.cs
- Source:
- Half.cs
- Source:
- Half.cs
Converts the string representation of a number in a specified style and culture-specific format to its single-precision floating-point number equivalent.
public static Half Parse (ReadOnlySpan<char> s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.Float, IFormatProvider? provider = default);
static member Parse : ReadOnlySpan<char> * System.Globalization.NumberStyles * IFormatProvider -> Half
Public Shared Function Parse (s As ReadOnlySpan(Of Char), Optional style As NumberStyles = System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.Float, Optional provider As IFormatProvider = Nothing) As Half
Parameters
- s
- ReadOnlySpan<Char>
Converts the string representation of a number to its half-precision floating-point number equivalent. A return value indicates whether the conversion succeeded or failed.
- 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
.
Returns
A half-precision floating-point number equivalent to the numeric value or symbol specified in s
.
Implements
Exceptions
s
does not represent a number in a valid format.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | 5, 6, 7, 8, 9 |
- Source:
- Half.cs
- Source:
- Half.cs
- Source:
- Half.cs
Converts the string representation of a number in a specified style and culture-specific format to its single-precision floating-point number equivalent.
public static Half Parse (string s, System.Globalization.NumberStyles style = System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.Float, IFormatProvider? provider = default);
static member Parse : string * System.Globalization.NumberStyles * IFormatProvider -> Half
Public Shared Function Parse (s As String, Optional style As NumberStyles = System.Globalization.NumberStyles.AllowThousands | System.Globalization.NumberStyles.Float, Optional provider As IFormatProvider = Nothing) As Half
Parameters
- s
- String
A string that contains a number to convert.
- 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
.
Returns
A half-precision floating-point number equivalent to the numeric value or symbol specified in s
.
Implements
Exceptions
s
is null
.
s
does not represent a number in a valid format.
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | 5, 6, 7, 8, 9 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: