Example #1
0
        /// <summary>
        ///   Returns a hash code for this instance.
        /// </summary>
        /// <returns>
        ///   A hash code for this instance, suitable for use in hashing algorithms and data
        ///   structures like a hash table.
        /// </returns>
        public override int GetHashCode()
        {
            var hash = HashCodeHelper.Initialize()
                       .Hash(Name)
                       .Hash(StandardOffset)
                       .Hash(Rules)
                       .Hash(Format)
                       .Hash(UntilYear);

            if (UntilYear != Int32.MaxValue)
            {
                hash = hash.Hash(UntilYearOffset.GetHashCode());
            }

            return(hash.Value);
        }
Example #2
0
        /// <summary>
        ///   Returns a hash code for this instance.
        /// </summary>
        /// <returns>
        ///   A hash code for this instance, suitable for use in hashing algorithms and data
        ///   structures like a hash table.
        /// </returns>
        public override int GetHashCode()
        {
            int hash = HashCodeHelper.Initialize();

            hash = HashCodeHelper.Hash(hash, Name);
            hash = HashCodeHelper.Hash(hash, Offset);
            hash = HashCodeHelper.Hash(hash, Rules);
            hash = HashCodeHelper.Hash(hash, Format);
            hash = HashCodeHelper.Hash(hash, UntilYear);
            if (UntilYear != Int32.MaxValue)
            {
                hash = HashCodeHelper.Hash(hash, UntilYearOffset.GetHashCode());
            }

            return(hash);
        }
Example #3
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" /> parameter;
        ///   otherwise, false.
        /// </returns>
        public bool Equals(ZoneLine other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }
            var result = Name == other.Name && StandardOffset == other.StandardOffset && Rules == other.Rules && Format == other.Format && UntilYear == other.UntilYear;

            if (UntilYear != Int32.MaxValue)
            {
                result = result && UntilYearOffset.Equals(other.UntilYearOffset);
            }
            return(result);
        }