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));
 }