![]() |
SystemEX
Lacking
Additional generic collection types missing in .net
|
Provides an extended and strongly typed comparison contract for SystemEx. More...
Public Member Functions | |
| CompareResult | CompareTo (T a) |
| Compares this instance with the specified value and returns a CompareResult describing the relationship between them. | |
Provides an extended and strongly typed comparison contract for SystemEx.
Unlike System.IComparable<T>, which returns an integer (-1, 0, +1), this interface uses the explicit CompareResult enumeration. This makes comparison outcomes easier to interpret and avoids ambiguity, especially in low‑level or domain‑specific types.
Compatibility with IComparable<T>:
Since CompareResult is backed by an integer, any type can implement both interfaces simultaneously. The standard CompareTo method can simply cast the extended result:
This interface is intentionally generic and can be implemented by any type: numeric primitives, geometric structures, colors, states, or any other domain‑specific objects requiring deterministic comparison semantics.
| T | The type that this instance can be compared against. |
| CompareResult SystemEx.IComparableEx< T >.CompareTo | ( | T | a | ) |
Compares this instance with the specified value and returns a CompareResult describing the relationship between them.
Implementations may define their own comparison rules, such as: magnitude-based, lexicographical, structural, bitwise, or any domain-specific logic required by the type.
The comparison must be deterministic and should not depend on external state, floating‑point environment, or platform-specific behavior. This makes the interface suitable for low-level systems, serialization, math primitives, and engine-independent utilities.
| a | The value to compare with this instance. |