/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; // Suitable nullity checks etc, of course :) hashCode = hashCode * 59 + PlayerNamesVisible.GetHashCode(); hashCode = hashCode * 59 + MaxPlayers.GetHashCode(); if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } hashCode = hashCode * 59 + RobotsPerPlayer.GetHashCode(); if (Password != null) { hashCode = hashCode * 59 + Password.GetHashCode(); } hashCode = hashCode * 59 + FillWithBots.GetHashCode(); return(hashCode); } }
/// <summary> /// Returns true if GameRules instances are equal /// </summary> /// <param name="other">Instance of GameRules to be compared</param> /// <returns>Boolean</returns> public bool Equals(GameRules other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( PlayerNamesVisible == other.PlayerNamesVisible || PlayerNamesVisible.Equals(other.PlayerNamesVisible) ) && ( MaxPlayers == other.MaxPlayers || MaxPlayers.Equals(other.MaxPlayers) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( RobotsPerPlayer == other.RobotsPerPlayer || RobotsPerPlayer.Equals(other.RobotsPerPlayer) ) && ( Password == other.Password || Password != null && Password.Equals(other.Password) ) && ( FillWithBots == other.FillWithBots || FillWithBots.Equals(other.FillWithBots) )); }