Exemplo n.º 1
0
        public static int ListToHashCode <TElement>(this ImmutableArray <TElement> lst)
            where TElement : unmanaged
        {
            var bytes = MemoryMarshal.AsBytes(lst.AsReadOnlySpan());

            return(xxHash64.Hash(bytes).GetHashCode());
        }
Exemplo n.º 2
0
 public static bool ListEquals <TElement>(this ImmutableArray <TElement> lst1, ImmutableArray <TElement> lst2)
     where TElement : struct, IEquatable <TElement>
 {
     // this works just fine for default / empty on either side.
     return(lst1.AsReadOnlySpan().SequenceEqual(lst2.AsReadOnlySpan()));
 }