Beispiel #1
0
        /// <summary>
        /// Returns a value indicating whether this instance is equal to the specified <see cref="NntpGroup"/> value.
        /// </summary>
        /// <param name="other">A <see cref="NntpGroup"/> object to compare to this instance.</param>
        /// <returns>true if <paramref name="other" /> has the same value as this instance; otherwise, false.</returns>
        public bool Equals(NntpGroup other)
        {
            if ((object)other == null)
            {
                return(false);
            }

            bool equals =
                Name.Equals(other.Name) &&
                ArticleCount.Equals(other.ArticleCount) &&
                LowWaterMark.Equals(other.LowWaterMark) &&
                HighWaterMark.Equals(other.HighWaterMark) &&
                PostingStatus.Equals(other.PostingStatus) &&
                OtherGroup.Equals(other.OtherGroup);

            if (!equals)
            {
                return(false);
            }

            // need to memoize the enumerables for comparison
            // otherwise they can not be used anymore after this call to equals
            if (!(ArticleNumbers is ICollection <long>))
            {
                ArticleNumbers = ArticleNumbers.ToList();
            }
            if (!(other.ArticleNumbers is ICollection <long>))
            {
                other.ArticleNumbers = other.ArticleNumbers.ToList();
            }

            return(ArticleNumbers.SequenceEqual(other.ArticleNumbers));
        }
Beispiel #2
0
 /// <summary>
 /// Returns a value indicating whether this instance is equal to the specified <see cref="NntpGroup"/> value.
 /// </summary>
 /// <param name="other">A <see cref="NntpGroup"/> object to compare to this instance.</param>
 /// <returns>true if <paramref name="other" /> has the same value as this instance; otherwise, false.</returns>
 public bool Equals(NntpGroup other)
 {
     if ((object)other == null)
     {
         return(false);
     }
     return
         (Name.Equals(other.Name) &&
          ArticleCount.Equals(other.ArticleCount) &&
          LowWaterMark.Equals(other.LowWaterMark) &&
          HighWaterMark.Equals(other.HighWaterMark) &&
          PostingStatus.Equals(other.PostingStatus) &&
          OtherGroup.Equals(other.OtherGroup) &&
          MultiSetComparer <int> .Instance.Equals(ArticleNumbers, other.ArticleNumbers));
 }
Beispiel #3
0
 /// <summary>
 /// Returns the hash code for this instance.
 /// </summary>
 /// <returns>A 32-bit signed integer hash code.</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hash = 17;
         hash *= 23 + Name.GetHashCode();
         hash *= 23 + ArticleCount.GetHashCode();
         hash *= 23 + LowWaterMark.GetHashCode();
         hash *= 23 + HighWaterMark.GetHashCode();
         hash *= 23 + PostingStatus.GetHashCode();
         hash *= 23 + OtherGroup.GetHashCode();
         hash *= 23 + ArticleNumbers.GetHashCode();
         return(hash);
     }
 }
Beispiel #4
0
 public override string ToString()
 {
     return($"{{{nameof(Offset)}={Offset.ToString("X")}, {nameof(ArticleListOffset)}={ArticleListOffset.ToString("X")}, {nameof(ArticleCount)}={ArticleCount.ToString()}, {nameof(StaticArticleEntries)}={string.Join(",", StaticArticleEntries.Select(x => x.ToString()).ToList())}}}");
 }