예제 #1
0
        public override int GetHashCode()
        {
            var theseReferences = this.elements
                                  .Select(pair => ComparablePair.From(pair.Key, pair.Value));

            return(theseReferences.SetHash());
        }
예제 #2
0
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            var that            = (Product)obj;
            var thoseReferences = that.elements
                                  .Select(pair => ComparablePair.From(pair.Key, pair.Value));
            var theseReferences = this.elements
                                  .Select(pair => ComparablePair.From(pair.Key, pair.Value));

            return(thoseReferences.SetEquals(theseReferences));
        }