Convert.FromHexString 方法

定义

重载

FromHexString(ReadOnlySpan<Char>)

将跨度(它将二进制数据编码为十六进制字符)转换为等效的 8 位无符号整数数组。Converts the span, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer array.

FromHexString(String)

将指定的字符串(它将二进制数据编码为十六进制字符)转换为等效的 8 位无符号整数数组。Converts the specified string, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer array.

FromHexString(ReadOnlySpan<Char>)

将跨度(它将二进制数据编码为十六进制字符)转换为等效的 8 位无符号整数数组。Converts the span, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer array.

public:
 static cli::array <System::Byte> ^ FromHexString(ReadOnlySpan<char> chars);
public static byte[] FromHexString (ReadOnlySpan<char> chars);
static member FromHexString : ReadOnlySpan<char> -> byte[]
Public Shared Function FromHexString (chars As ReadOnlySpan(Of Char)) As Byte()

参数

chars
ReadOnlySpan<Char>

要转换的跨度。The span to convert.

返回

Byte[]

chars 等效的 8 位无符号整数数组。An array of 8-bit unsigned integers that is equivalent to chars.

例外

chars 的长度不是零或 2 的倍数。The length of chars, is not zero or a multiple of 2.

chars 的格式无效。The format of chars is invalid. chars 包含非十六进制字符。chars contains a non-hex character.

适用于

FromHexString(String)

将指定的字符串(它将二进制数据编码为十六进制字符)转换为等效的 8 位无符号整数数组。Converts the specified string, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer array.

public:
 static cli::array <System::Byte> ^ FromHexString(System::String ^ s);
public static byte[] FromHexString (string s);
static member FromHexString : string -> byte[]
Public Shared Function FromHexString (s As String) As Byte()

参数

s
String

要转换的字符串。The string to convert.

返回

Byte[]

s 等效的 8 位无符号整数数组。An array of 8-bit unsigned integers that is equivalent to s.

例外

snulls is null.

s 的长度不是零或 2 的倍数。The length of s, is not zero or a multiple of 2.

s 的格式无效。The format of s is invalid. s 包含非十六进制字符。s contains a non-hex character.

适用于