اقرأ باللغة الإنجليزية تحرير

مشاركة عبر


BitConverter.ToHalf Method

Definition

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.

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<byte> value);

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

.NET 10 والإصدارات الأخرى
منتج الإصدارات
.NET 6, 7, 8, 9, 10

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(byte[] value, int startIndex);

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

.NET 10 والإصدارات الأخرى
منتج الإصدارات
.NET 6, 7, 8, 9, 10