/// <summary> /// Override of the get hash code method. /// </summary> /// <returns></returns> public override int GetHashCode() { //Get hash code for the nullable fields. int hashHostName = HostName == null ? 0 : HostName.GetHashCode(); int hashPublicUri = PublicUri == null ? 0 : PublicUri.GetHashCode(); int hashHubs = Hubs == null ? 0 : Hubs.Distinct().Aggregate(0, (x, y) => x.GetHashCode() ^ y.GetHashCode());; //Calculate the hash code for the GPOPolicy. return(StartedAt.GetHashCode() ^ hashHostName ^ hashPublicUri ^ hashHubs); }
/// <summary> /// Override of the equality method. /// </summary> /// <param name="o"></param> /// <returns></returns> public bool Equals(SignalRServers o) { //Check whether the compared object is null. if (ReferenceEquals(o, null)) { return(false); } //Check whether the compared object references the same data. if (ReferenceEquals(this, o)) { return(true); } //Check whether the SignalRServers' properties are equal. return(StartedAt.Equals(o.StartedAt) && HostName.Equals(o.HostName) && PublicUri.Equals(o.PublicUri) && Tools.SequenceEqual(Hubs, o.Hubs)); }