예제 #1
0
 int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer)
 {
     return(FdbTuple.CombineHashCodes(
                comparer.GetHashCode(this.Item1),
                comparer.GetHashCode(this.Item2)
                ));
 }
 int IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer)
 {
     return(HashCodes.Combine(
                m_prefix.GetHashCode(),
                comparer.GetHashCode(m_items)
                ));
 }
 int IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer)
 {
     return(FdbTuple.CombineHashCodes(
                this.Head != null ? this.Head.GetHashCode(comparer) : 0,
                comparer.GetHashCode(this.Tail)
                ));
 }
예제 #4
0
파일: FuncyList.cs 프로젝트: forki/Funcy
        public override int GetHashCode(System.Collections.IEqualityComparer comparer)
        {
            int hash = 17;

            hash = hash * 31 + comparer.GetHashCode(this.head);
            hash = hash * 31 + this.tail.GetHashCode(comparer);
            return(hash);
        }
예제 #5
0
        int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer)
        {
            int h = this.Head.GetHashCode(comparer);

            // we can't combine with the hashcode of the tail because Combine(H(head), H(tail)) != Combine(H(this[0]), H(this[1]), ... H(this[N-1]))
            foreach (var item in this.Tail)
            {
                h = HashCodes.Combine(h, comparer.GetHashCode(item));
            }
            return(h);
        }
예제 #6
0
        int IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer)
        {
            // the cached hashcode is only valid for the default comparer!
            bool canUseCache = object.ReferenceEquals(comparer, SimilarValueComparer.Default);

            if (m_hashCode.HasValue && canUseCache)
            {
                return(m_hashCode.Value);
            }

            int h = 0;

            for (int i = 0; i < m_count; i++)
            {
                var item = m_items[i + m_offset];

                h = HashCodes.Combine(h, comparer.GetHashCode(item));
            }
            if (canUseCache)
            {
                m_hashCode = h;
            }
            return(h);
        }
예제 #7
0
파일: Either.cs 프로젝트: forki/Funcy
 public override int GetHashCode(System.Collections.IEqualityComparer comparer)
 {
     return(comparer.GetHashCode(this.value));
 }