Half.CompareTo Method

Definition

Overloads

CompareTo(Half)

Compares this instance to a specified half-precision floating-point number and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified half-precision floating-point number.

CompareTo(Object)

Compares this instance to a specified object and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified object.

CompareTo(Half)

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

Compares this instance to a specified half-precision floating-point number and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified half-precision floating-point number.

public int CompareTo (Half other);

Parameters

other
Half

A half-precision floating-point number to compare.

Returns

A value less than zero if this is less than other, zero if this is equal to other, or a value greater than zero if this is greater than other.

Implements

Applies to

.NET 9 和其他版本
产品 版本
.NET 5, 6, 7, 8, 9

CompareTo(Object)

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

Compares this instance to a specified object and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified object.

public int CompareTo (object? obj);

Parameters

obj
Object

An object to compare, or null.

Returns

A value less than zero if this instance is less than obj, or this instance is not a number (NaN) and obj is a number.

-or-

Zero if this instance is equal to obj, or this instance and obj are both not a number (NaN), PositiveInfinity, or NegativeInfinity.

-or-

A value greater than zero if this instance is greater than obj, or this instance is a number and obj is not a number (NaN), or obj is null.

Implements

Exceptions

obj is not of type Half.

Applies to

.NET 9 和其他版本
产品 版本
.NET 5, 6, 7, 8, 9