public override int GetHashCode() { var theseReferences = this.elements .Select(pair => ComparablePair.From(pair.Key, pair.Value)); return(theseReferences.SetHash()); }
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)); }