Edit

Share via


NFloat.CompareTo 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

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

Compares this instance to a specified 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 floating-point number.

CompareTo(Object)

Source:
NFloat.cs
Source:
NFloat.cs
Source:
NFloat.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 signed number indicating the relative values of this instance and obj.

Return ValueDescription
Less than zeroThis instance is less than obj, or this instance is not a number and obj is a number.
ZeroThis instance is equal to obj, or both this instance and obj are not a number.
Greater than zeroThis instance is greater than obj, or this instance is a number and obj is not a number or obj is null.

Implements

Exceptions

obj is not a NFloat.

Applies to

.NET 10 and other versions
Product Versions
.NET 7, 8, 9, 10

CompareTo(NFloat)

Source:
NFloat.cs
Source:
NFloat.cs
Source:
NFloat.cs

Compares this instance to a specified 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 floating-point number.

public int CompareTo(System.Runtime.InteropServices.NFloat other);

Parameters

other
NFloat

A floating-point number to compare.

Returns

A signed number indicating the relative values of this instance and other.

Return ValueDescription
Less than zeroThis instance is less than other, or this instance is not a number and other is a number.
ZeroThis instance is equal to other, or both this instance and other are not a number.
Greater than zeroThis instance is greater than other, or this instance is a number and other is not a number.

Implements

Applies to

.NET 10 and other versions
Product Versions
.NET 7, 8, 9, 10