public override int GetHashCode() { unchecked { int hashCode = (Position != null ? Position.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Radius.GetHashCode(); hashCode = (hashCode * 397) ^ (ContinentId != null ? ContinentId.GetHashCode() : 0); hashCode = (hashCode * 397) ^ TileX.GetHashCode(); hashCode = (hashCode * 397) ^ TileY.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { // based on http://stackoverflow.com/questions/5221396/what-is-an-appropriate-gethashcode-algorithm-for-a-2d-point-struct-avoiding unchecked // Overflow is fine, just wrap { int hash = 17; hash = hash * 23 + TileX.GetHashCode(); hash = hash * 23 + X.GetHashCode(); hash = hash * 23 + TileY.GetHashCode(); hash = hash * 23 + Y.GetHashCode(); return(hash); } }