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

            return
                ((
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                     ) &&
                 (
                     DateString == other.DateString ||
                     DateString != null &&
                     DateString.Equals(other.DateString)
                 ) &&
                 (
                     Date == other.Date ||
                     Date != null &&
                     Date.Equals(other.Date)
                 ) &&
                 (
                     Sgv == other.Sgv ||
                     Sgv != null &&
                     Sgv.Equals(other.Sgv)
                 ) &&
                 (
                     Direction == other.Direction ||
                     Direction != null &&
                     Direction.Equals(other.Direction)
                 ) &&
                 (
                     Noise == other.Noise ||
                     Noise != null &&
                     Noise.Equals(other.Noise)
                 ) &&
                 (
                     Filtered == other.Filtered ||
                     Filtered != null &&
                     Filtered.Equals(other.Filtered)
                 ) &&
                 (
                     Unfiltered == other.Unfiltered ||
                     Unfiltered != null &&
                     Unfiltered.Equals(other.Unfiltered)
                 ) &&
                 (
                     Rssi == other.Rssi ||
                     Rssi != null &&
                     Rssi.Equals(other.Rssi)
                 ));
        }
コード例 #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 (Type != null)
                {
                    hash = hash * 59 + Type.GetHashCode();
                }

                if (DateString != null)
                {
                    hash = hash * 59 + DateString.GetHashCode();
                }

                if (Date != null)
                {
                    hash = hash * 59 + Date.GetHashCode();
                }

                if (Sgv != null)
                {
                    hash = hash * 59 + Sgv.GetHashCode();
                }

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

                if (Noise != null)
                {
                    hash = hash * 59 + Noise.GetHashCode();
                }

                if (Filtered != null)
                {
                    hash = hash * 59 + Filtered.GetHashCode();
                }

                if (Unfiltered != null)
                {
                    hash = hash * 59 + Unfiltered.GetHashCode();
                }

                if (Rssi != null)
                {
                    hash = hash * 59 + Rssi.GetHashCode();
                }

                return(hash);
            }
        }