Class StoreShallowEqualityComparer
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
public static class StoreShallowEqualityComparer
- Inheritance
-
objectStoreShallowEqualityComparer
Remarks
For a selector returning a list, where a fresh instance of the same elements should not read as a
change: UseStore(store, s => s.Items, StoreShallowEqualityComparer.Sequence<Item>()).
A selector returning a tuple or a value-type record needs no comparer —
UseStore<TStore, TSel>(Store<TStore>, Func<TStore, TSel>, IEqualityComparer<TSel>?) documents which selector shapes its default already
answers for.
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 (strings compare by ordinal value instead), bit-pattern equality for float/double, and boxed value equality for other value types. A fresh-but-value-equal reference-type element (other than a string) therefore counts as changed.