TupleComparisons

Namespace: SnowBank.Data.Tuples · class

Helper class for tuple comparisons

Methods

Composite

static CompositeComparer<T1> Composite<T1>(int offset = 0, IComparer<T1> comparer = null)

Create a new instance that compares a single item position in two tuples

  • offset — Offset of the item to compare (can be negative)
  • comparer — Comparer for the item's type

Returns: New comparer instance

static CompositeComparer<T1, T2> Composite<T1, T2>(int offset = 0, IComparer<T1> comparer1 = null, IComparer<T2> comparer2 = null)

Create a new instance that compares two consecutive items in two tuples

  • offset — Offset of the first item to compare (can be negative)
  • comparer1 — Comparer for the first item's type
  • comparer2 — Comparer for the second item's type

Returns: New comparer instance

static CompositeComparer<T1, T2, T3> Composite<T1, T2, T3>(int offset = 0, IComparer<T1> comparer1 = null, IComparer<T2> comparer2 = null, IComparer<T3> comparer3 = null)

Create a new instance that compares three consecutive items in two tuples

  • offset — Offset of the first item to compare (can be negative)
  • comparer1 — Comparer for the first item's type
  • comparer2 — Comparer for the second item's type
  • comparer3 — Comparer for the third item's type

Returns: New comparer instance

Fields

Bcl

static readonly EqualityComparer Bcl

Tuple comparer that uses the default BCL object comparison ("123" != 123 != 123L != 123.0d)

Default

static readonly EqualityComparer Default

Tuple comparer that treats similar values as equal ("123" = 123 = 123L = 123.0d)