Пример #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));
        }