Beispiel #1
0
        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns>
        /// true if the current object is equal to the <paramref name="other">other</paramref> parameter; otherwise, false.
        /// </returns>
        public bool Equals(PointData other)
        {
            if (other == null)
            {
                return(false);
            }
            var otherTags = other._tags;

            var result = _tags.Count == otherTags.Count &&
                         _tags.All(pair =>
            {
                var key   = pair.Key;
                var value = pair.Value;
                return(otherTags.ContainsKey(key) &&
                       otherTags[key] == value);
            });
            var otherFields = other._fields;

            result = result && _fields.Count == otherFields.Count &&
                     _fields.All(pair =>
            {
                var key   = pair.Key;
                var value = pair.Value;
                return(otherFields.ContainsKey(key) &&
                       object.Equals(otherFields[key], value));
            });

            result = result &&
                     _measurementName == other._measurementName &&
                     Precision == other.Precision &&
                     EqualityComparer <BigInteger?> .Default.Equals(_time, other._time);

            return(result);
        }