示例#1
0
        /// <summary>
        /// Returns true if Thing instances are equal
        /// </summary>
        /// <param name="other">Instance of Thing to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Thing other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Thingtype == other.Thingtype ||
                     Thingtype != null &&
                     Thingtype.Equals(other.Thingtype)
                 ) &&
                 (
                     ThingTemplate == other.ThingTemplate ||
                     ThingTemplate != null &&
                     ThingTemplate.Equals(other.ThingTemplate)
                 ) &&
                 (
                     Status == other.Status ||
                     Status != null &&
                     Status.Equals(other.Status)
                 ) &&
                 (
                     Lat == other.Lat ||
                     Lat != null &&
                     Lat.Equals(other.Lat)
                 ) &&
                 (
                     Lon == other.Lon ||
                     Lon != null &&
                     Lon.Equals(other.Lon)
                 ) &&
                 (
                     Ogcid == other.Ogcid ||
                     Ogcid != null &&
                     Ogcid.Equals(other.Ogcid)
                 ));
        }
示例#2
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 (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (Thingtype != null)
         {
             hashCode = hashCode * 59 + Thingtype.GetHashCode();
         }
         if (ThingTemplate != null)
         {
             hashCode = hashCode * 59 + ThingTemplate.GetHashCode();
         }
         if (Status != null)
         {
             hashCode = hashCode * 59 + Status.GetHashCode();
         }
         if (Lat != null)
         {
             hashCode = hashCode * 59 + Lat.GetHashCode();
         }
         if (Lon != null)
         {
             hashCode = hashCode * 59 + Lon.GetHashCode();
         }
         if (Ogcid != null)
         {
             hashCode = hashCode * 59 + Ogcid.GetHashCode();
         }
         return(hashCode);
     }
 }