TupleComparisons.CompositeComparer<T1>

Namespace: SnowBank.Data.Tuples · class

Implements: IComparer<IVarTuple>, IComparer<STuple<T1>>, IComparer<(T1)>

Comparer that compares tuples with at least 1 item

Constructors

CompositeComparer<T1>

CompositeComparer<T1>()

Constructor for a new tuple comparer

CompositeComparer<T1>(IComparer<T1> comparer)

Constructor for a new tuple comparer

CompositeComparer<T1>(int offset, IComparer<T1> comparer)

Constructor for a new tuple comparer

  • offset — Offset in the tuples of the element to compare (can be negative)
  • comparer — Comparer for the element type

Properties

Comparer

IComparer<T1> Comparer { get; }

Comparer for the first element (at position Offset)

Offset

int Offset { get; }

Offset in the tuples where the comparison starts

If negative, comparison starts from the end.

Methods

Compare

int Compare(IVarTuple x, IVarTuple y)

Compare a single item in both tuples

  • x — First tuple
  • y — Second tuple

Returns: Returns a positive value if x is greater than y, a negative value if x is less than y and 0 if x is equal to y.

int Compare(STuple<T1> x, STuple<T1> y)

Compare two tuples

  • x — First tuple
  • y — Second tuple

Returns: Returns a positive value if x is greater than y, a negative value if x is less than y and 0 if x is equal to y.

int Compare((T1) x, (T1) y)

Compare two tuples

  • x — First tuple
  • y — Second tuple

Returns: Returns a positive value if x is greater than y, a negative value if x is less than y and 0 if x is equal to y.

Fields

Default

static readonly IComparer<IVarTuple> Default