Table of Contents

Class NoxValueComparer

Namespace
Nox.Grid
Assembly
Nox.Grid.dll

Compares values for sorting. Empty values (null, DBNull, "") come first; numbers compare by magnitude even across types; text compares using the current culture's order.

public sealed class NoxValueComparer : IComparer<object>
Inheritance
NoxValueComparer
Implements
Inherited Members

Constructors

NoxValueComparer(CultureInfo)

Creates a comparer that compares text with the given culture.

public NoxValueComparer(CultureInfo culture)

Parameters

culture CultureInfo

Fields

Default

Comparer for the current culture.

public static readonly NoxValueComparer Default

Field Value

NoxValueComparer

Methods

Compare(object, object)

Compares two cell values for sorting: empty values first, numbers by value, dates by time, text by culture.

public int Compare(object x, object y)

Parameters

x object
y object

Returns

int

CompareNatural(object, object)

Compares like Compare, but runs of digits inside text compare as numbers: "2" before "10", "1:80" before "1:1280", "9h" before "13h". Digit runs compare by length first (leading zeros ignored), so long numbers such as barcodes never overflow. Values that differ only in leading zeros fall back to text order.

public int CompareNatural(object x, object y)

Parameters

x object
y object

Returns

int

IsEmpty(object)

Whether the value counts as empty (Nothing, DBNull or empty text).

public static bool IsEmpty(object value)

Parameters

value object

Returns

bool

IsNumber(object)

Whether the value is a number type.

public static bool IsNumber(object value)

Parameters

value object

Returns

bool