Redigera

Dela via


Convert.FromHexString Method

Definition

Overloads

FromHexString(ReadOnlySpan<Char>)

Converts the span, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer array.

FromHexString(String)

Converts the specified string, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer array.

FromHexString(ReadOnlySpan<Char>, Span<Byte>, Int32, Int32)

Converts the span of chars, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer span.

FromHexString(String, Span<Byte>, Int32, Int32)

Converts the string, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer span.

FromHexString(ReadOnlySpan<Char>)

Source:
Convert.cs
Source:
Convert.cs
Source:
Convert.cs

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()

Parameters

chars
ReadOnlySpan<Char>

The span to convert.

Returns

Byte[]

An array of 8-bit unsigned integers that is equivalent to chars.

Exceptions

The length of chars, is not zero or a multiple of 2.

The format of chars is invalid. chars contains a non-hex character.

Applies to

FromHexString(String)

Source:
Convert.cs
Source:
Convert.cs
Source:
Convert.cs

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()

Parameters

s
String

The string to convert.

Returns

Byte[]

An array of 8-bit unsigned integers that is equivalent to s.

Exceptions

The length of s, is not zero or a multiple of 2.

The format of s is invalid. s contains a non-hex character.

Applies to

FromHexString(ReadOnlySpan<Char>, Span<Byte>, Int32, Int32)

Source:
Convert.cs

Converts the span of chars, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer span.

public:
 static System::Buffers::OperationStatus FromHexString(ReadOnlySpan<char> source, Span<System::Byte> destination, [Runtime::InteropServices::Out] int % charsConsumed, [Runtime::InteropServices::Out] int % bytesWritten);
public static System.Buffers.OperationStatus FromHexString (ReadOnlySpan<char> source, Span<byte> destination, out int charsConsumed, out int bytesWritten);
static member FromHexString : ReadOnlySpan<char> * Span<byte> * int * int -> System.Buffers.OperationStatus
Public Shared Function FromHexString (source As ReadOnlySpan(Of Char), destination As Span(Of Byte), ByRef charsConsumed As Integer, ByRef bytesWritten As Integer) As OperationStatus

Parameters

source
ReadOnlySpan<Char>

The span to convert.

destination
Span<Byte>

The span in which to write the converted 8-bit unsigned integers. When this method returns value different than Done, either the span remains unmodified or contains an incomplete conversion of source, up to the last valid character.

charsConsumed
Int32

When this method returns, contains the number of characters that were consumed from source.

bytesWritten
Int32

When this method returns, contains the number of bytes that were written to destination.

Returns

An OperationStatus describing the result of the operation.

Applies to

FromHexString(String, Span<Byte>, Int32, Int32)

Source:
Convert.cs

Converts the string, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer span.

public:
 static System::Buffers::OperationStatus FromHexString(System::String ^ source, Span<System::Byte> destination, [Runtime::InteropServices::Out] int % charsConsumed, [Runtime::InteropServices::Out] int % bytesWritten);
public static System.Buffers.OperationStatus FromHexString (string source, Span<byte> destination, out int charsConsumed, out int bytesWritten);
static member FromHexString : string * Span<byte> * int * int -> System.Buffers.OperationStatus
Public Shared Function FromHexString (source As String, destination As Span(Of Byte), ByRef charsConsumed As Integer, ByRef bytesWritten As Integer) As OperationStatus

Parameters

source
String

The string to convert.

destination
Span<Byte>

The span in which to write the converted 8-bit unsigned integers. When this method returns value different than Done, either the span remains unmodified or contains an incomplete conversion of source, up to the last valid character.

charsConsumed
Int32

When this method returns, contains the number of characters that were consumed from source.

bytesWritten
Int32

When this method returns, contains the number of bytes that were written to destination.

Returns

An OperationStatus describing the result of the operation.

Exceptions

Passed string source is null.

Applies to