Half.Parse 方法

定义

重载

Parse(String)

将数字的字符串表示形式转换为其等效的半精度浮点数。

Parse(ReadOnlySpan<Byte>, IFormatProvider)

将 UTF-8 字符范围分析为值。

Parse(ReadOnlySpan<Char>, IFormatProvider)

将字符范围解析为值。

Parse(String, NumberStyles)

将具有指定样式的数字的字符串表示形式转换为它的等效单精度浮点数。

Parse(String, IFormatProvider)

将具有指定区域性特定格式的数字的字符串表示形式转换为它的等效单精度浮点数。

Parse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider)

将 UTF-8 字符范围分析为值。

Parse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider)

将具有指定样式和区域性特定格式的数字的字符串表示形式转换为它的等效单精度浮点数。

Parse(String, NumberStyles, IFormatProvider)

将具有指定样式和区域性特定格式的数字的字符串表示形式转换为它的等效单精度浮点数。

Parse(String)

Source:
Half.cs
Source:
Half.cs
Source:
Half.cs

将数字的字符串表示形式转换为其等效的半精度浮点数。

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

参数

s
String

包含要转换的数字的字符串。

返回

s 中指定的数值或符号等效的半精度浮点数字。

例外

snull

s 不表示具有有效格式的数字。

s 表示一个小于 MinValue 或大于 MaxValue 的数字。

适用于

Parse(ReadOnlySpan<Byte>, IFormatProvider)

Source:
Half.cs
Source:
Half.cs

将 UTF-8 字符范围分析为值。

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

参数

utf8Text
ReadOnlySpan<Byte>

要分析的 UTF-8 字符的跨度。

provider
IFormatProvider

一个对象,提供有关 utf8Text 的区域性特定格式设置信息。

返回

分析 utf8Text的结果。

实现

适用于

Parse(ReadOnlySpan<Char>, IFormatProvider)

Source:
Half.cs
Source:
Half.cs
Source:
Half.cs

将字符范围解析为值。

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

参数

s
ReadOnlySpan<Char>

要分析的字符范围。

provider
IFormatProvider

一个对象,提供有关 s 的区域性特定格式设置信息。

返回

分析 s的结果。

实现

适用于

Parse(String, NumberStyles)

Source:
Half.cs
Source:
Half.cs
Source:
Half.cs

将具有指定样式的数字的字符串表示形式转换为它的等效单精度浮点数。

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

参数

s
String

包含要转换的数字的字符串。

style
NumberStyles

枚举值的按位组合,用于指示可出现在 s 中的样式元素。

返回

s 中指定的数值或符号等效的半精度浮点数字。

例外

snull

s 不表示具有有效格式的数字。

s 表示一个小于 MinValue 或大于 MaxValue 的数字。

style 不是 NumberStyles 值。

NumberStyles 包括 AllowHexSpecifier 值。

适用于

Parse(String, IFormatProvider)

Source:
Half.cs
Source:
Half.cs
Source:
Half.cs

将具有指定区域性特定格式的数字的字符串表示形式转换为它的等效单精度浮点数。

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

参数

s
String

包含要转换的数字的字符串。

provider
IFormatProvider

一个对象,提供有关 s 的区域性特定格式设置信息。

返回

s 中指定的数值或符号等效的半精度浮点数字。

实现

例外

snull

s 不表示具有有效格式的数字。

s 表示一个小于 MinValue 或大于 MaxValue 的数字。

适用于

Parse(ReadOnlySpan<Byte>, NumberStyles, IFormatProvider)

Source:
Half.cs
Source:
Half.cs

将 UTF-8 字符范围分析为值。

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

参数

utf8Text
ReadOnlySpan<Byte>

要分析的 UTF-8 字符的跨度。

style
NumberStyles

可以存在于 中的 utf8Text数字样式的按位组合。

provider
IFormatProvider

一个对象,提供有关 utf8Text 的区域性特定格式设置信息。

返回

分析 utf8Text的结果。

实现

适用于

Parse(ReadOnlySpan<Char>, NumberStyles, IFormatProvider)

Source:
Half.cs
Source:
Half.cs
Source:
Half.cs

将具有指定样式和区域性特定格式的数字的字符串表示形式转换为它的等效单精度浮点数。

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

参数

s
ReadOnlySpan<Char>

将数字的字符串表示形式转换为其等效的半精度浮点数。 一个指示转换是否成功的返回值。

style
NumberStyles

枚举值的按位组合,用于指示可出现在 s 中的样式元素。

provider
IFormatProvider

一个对象,提供有关 s 的区域性特定格式设置信息。

返回

s 中指定的数值或符号等效的半精度浮点数字。

实现

例外

s 不表示具有有效格式的数字。

style 不是 NumberStyles 值。

NumberStyles 包括 AllowHexSpecifier 值。

适用于

Parse(String, NumberStyles, IFormatProvider)

Source:
Half.cs
Source:
Half.cs
Source:
Half.cs

将具有指定样式和区域性特定格式的数字的字符串表示形式转换为它的等效单精度浮点数。

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

参数

s
String

包含要转换的数字的字符串。

style
NumberStyles

枚举值的按位组合,用于指示可出现在 s 中的样式元素。

provider
IFormatProvider

一个对象,提供有关 s 的区域性特定格式设置信息。

返回

s 中指定的数值或符号等效的半精度浮点数字。

实现

例外

snull

s 不表示具有有效格式的数字。

s 表示一个小于 MinValue 或大于 MaxValue 的数字。

style 不是 NumberStyles 值。

NumberStyles 包括 AllowHexSpecifier 值。

适用于