Beispiel #1
0
        /// <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 + Number.GetHashCode();
                if (CheckedBy != null)
                {
                    hashCode = hashCode * 59 + CheckedBy.GetHashCode();
                }

                hashCode = hashCode * 59 + Direction.GetHashCode();
                if (Name != null)
                {
                    hashCode = hashCode * 59 + Name.GetHashCode();
                }

                hashCode = hashCode * 59 + Id.GetHashCode();
                if (Location != null)
                {
                    hashCode = hashCode * 59 + Location.GetHashCode();
                }
                return(hashCode);
            }
        }
Beispiel #2
0
        /// <summary>
        ///     Returns true if Checkpoint instances are equal
        /// </summary>
        /// <param name="other">Instance of Checkpoint to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Checkpoint other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Number == other.Number ||
                     Number.Equals(other.Number)
                     ) &&
                 (
                     CheckedBy == other.CheckedBy ||
                     CheckedBy != null &&
                     other.CheckedBy != null &&
                     CheckedBy.SequenceEqual(other.CheckedBy)
                 ) &&
                 (
                     Direction == other.Direction ||
                     Direction.Equals(other.Direction)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     Id == other.Id ||
                     Id.Equals(other.Id)
                 ) &&
                 (
                     Location == other.Location ||
                     Location != null &&
                     Location.Equals(other.Location)
                 ));
        }