Beispiel #1
0
 /// <summary>
 ///    Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>
 ///    A hash code for the current <see cref="T:System.Object" />.
 /// </returns>
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ HasCollar.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)Nose;
         hashCode = (hashCode * 397) ^ Bone.GetHashCode();
         hashCode = (hashCode * 397) ^ (Collar != null ? Collar.GetHashCode() : 0);
         return(hashCode);
     }
 }
Beispiel #2
0
 /// <summary>
 ///    Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <returns>
 ///    true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false.
 /// </returns>
 /// <param name="other">An object to compare with this object.</param>
 public bool Equals(Dog other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(base.Equals(other) && HasCollar.Equals(other.HasCollar) && Nose == other.Nose && Bone.Equals(other.Bone) &&
            Equals(Collar, other.Collar));
 }