Ejemplo n.º 1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Category != null)
         {
             hashCode = hashCode * 59 + Category.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (PhotoUrls != null)
         {
             hashCode = hashCode * 59 + PhotoUrls.GetHashCode();
         }
         if (Tags != null)
         {
             hashCode = hashCode * 59 + Tags.GetHashCode();
         }
         if (Status != null)
         {
             hashCode = hashCode * 59 + Status.GetHashCode();
         }
         return(hashCode);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     // credit: http://stackoverflow.com/a/263416/677735
     unchecked // Overflow is fine, just wrap
     {
         var hash = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hash = hash * 59 + Id.GetHashCode();
         }
         if (Category != null)
         {
             hash = hash * 59 + Category.GetHashCode();
         }
         if (Name != null)
         {
             hash = hash * 59 + Name.GetHashCode();
         }
         if (PhotoUrls != null)
         {
             hash = hash * 59 + PhotoUrls.GetHashCode();
         }
         if (Tags != null)
         {
             hash = hash * 59 + Tags.GetHashCode();
         }
         if (Status != null)
         {
             hash = hash * 59 + Status.GetHashCode();
         }
         return(hash);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns true if Pet instances are equal
        /// </summary>
        /// <param name="other">Instance of Pet to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Pet other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||

                     Id.Equals(other.Id)
                     ) &&
                 (
                     Category == other.Category ||
                     Category != null &&
                     Category.Equals(other.Category)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     PhotoUrls == other.PhotoUrls ||
                     PhotoUrls != null &&
                     other.PhotoUrls != null &&
                     PhotoUrls.SequenceEqual(other.PhotoUrls)
                 ) &&
                 (
                     Tags == other.Tags ||
                     Tags != null &&
                     other.Tags != null &&
                     Tags.SequenceEqual(other.Tags)
                 ) &&
                 (
                     Status == other.Status ||

                     Status.Equals(other.Status)
                 ));
        }
Ejemplo n.º 4
0
 public string GetPhotoUrl(int number)
 {
     return(PhotoUrls.Split(",").ToArray()[number]);
 }