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

            return
                ((
                     ThingId == other.ThingId ||
                     ThingId != null &&
                     ThingId.Equals(other.ThingId)
                     ) &&
                 (
                     DatastreamId == other.DatastreamId ||
                     DatastreamId != null &&
                     DatastreamId.Equals(other.DatastreamId)
                 ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ) &&
                 (
                     Personid == other.Personid ||
                     Personid != null &&
                     Personid.Equals(other.Personid)
                 ) &&
                 (
                     Zoneid == other.Zoneid ||
                     Zoneid != null &&
                     Zoneid.Equals(other.Zoneid)
                 ) &&
                 (
                     PhenomenTime == other.PhenomenTime ||
                     PhenomenTime != null &&
                     PhenomenTime.Equals(other.PhenomenTime)
                 ) &&
                 (
                     ObservationResult == other.ObservationResult ||
                     ObservationResult != null &&
                     ObservationResult.Equals(other.ObservationResult)
                 ));
        }
示例#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 (ThingId != null)
         {
             hashCode = hashCode * 59 + ThingId.GetHashCode();
         }
         if (DatastreamId != null)
         {
             hashCode = hashCode * 59 + DatastreamId.GetHashCode();
         }
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Personid != null)
         {
             hashCode = hashCode * 59 + Personid.GetHashCode();
         }
         if (Zoneid != null)
         {
             hashCode = hashCode * 59 + Zoneid.GetHashCode();
         }
         if (PhenomenTime != null)
         {
             hashCode = hashCode * 59 + PhenomenTime.GetHashCode();
         }
         if (ObservationResult != null)
         {
             hashCode = hashCode * 59 + ObservationResult.GetHashCode();
         }
         return(hashCode);
     }
 }