Bewerken

Share via


BitConverter.ToHalf Method

Definition

Overloads

ToHalf(ReadOnlySpan<Byte>)

Converts a read-only byte span into a half-precision floating-point value.

ToHalf(Byte[], Int32)

Returns a half-precision floating point number converted from two bytes at a specified position in a byte array.

ToHalf(ReadOnlySpan<Byte>)

Source:
BitConverter.cs
Source:
BitConverter.cs
Source:
BitConverter.cs

Converts a read-only byte span into a half-precision floating-point value.

public:
 static Half ToHalf(ReadOnlySpan<System::Byte> value);
public static Half ToHalf (ReadOnlySpan<byte> value);
static member ToHalf : ReadOnlySpan<byte> -> Half
Public Shared Function ToHalf (value As ReadOnlySpan(Of Byte)) As Half

Parameters

value
ReadOnlySpan<Byte>

A read-only span containing the bytes to convert.

Returns

A half-precision floating-point value that represents the converted bytes.

Exceptions

The length of value is less than 2.

Applies to

ToHalf(Byte[], Int32)

Source:
BitConverter.cs
Source:
BitConverter.cs
Source:
BitConverter.cs

Returns a half-precision floating point number converted from two bytes at a specified position in a byte array.

public:
 static Half ToHalf(cli::array <System::Byte> ^ value, int startIndex);
public static Half ToHalf (byte[] value, int startIndex);
static member ToHalf : byte[] * int -> Half
Public Shared Function ToHalf (value As Byte(), startIndex As Integer) As Half

Parameters

value
Byte[]

An array of bytes that includes the two bytes to convert.

startIndex
Int32

The starting position within value.

Returns

A half-precision floating point number formed by two bytes beginning at startIndex.

Exceptions

startIndex equals the length of value minus 1.

value is null.

startIndex is less than zero or greater than the length of value minus 1.

Applies to