Class StoreShallowEqualityComparer
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
Shallow equality comparers for selector return values that are sequences. Reference-equal elements at matching positions and matching lengths are considered equal; deep equality is intentionally not performed.
public static class StoreShallowEqualityComparer
- Inheritance
-
objectStoreShallowEqualityComparer
Remarks
Use this for selectors that return an array/list slice, where a fresh list instance with the
same elements should not be treated as a change. The canonical form is
UseStore(store, s => s.Items, StoreShallowEqualityComparer.Sequence<Item>()).
Tuple / record selectors do not need this helper — System.Collections.Generic.EqualityComparer<T>.Default
already performs member-wise equality for ValueTuple and value-type records.
Methods
- Sequence<T>()
Returns a comparer that treats two System.Collections.Generic.IReadOnlyList<T> as equal when their lengths match and each element pair is
Object.is-equal: reference identity for reference types, bit-pattern equality for float/double, and boxed value equality for other value types. A fresh-but-value-equal reference-type element therefore counts as changed.