GetHashCode() public method

public GetHashCode ( ) : int
return int
Example #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (CreatedTime.Length != 0)
            {
                hash ^= CreatedTime.GetHashCode();
            }
            if (Author.Length != 0)
            {
                hash ^= Author.GetHashCode();
            }
            if (Office.Length != 0)
            {
                hash ^= Office.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (Author != null)
         {
             hashCode = hashCode * 59 + Author.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (ConfigDescriptionURI != null)
         {
             hashCode = hashCode * 59 + ConfigDescriptionURI.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #3
0
        /// <summary>
        /// Gets Hash Code for current Book instance.
        /// </summary>
        /// <returns> Hash Code</returns>
        public override int GetHashCode()
        {
            int hash = ((((Author.GetHashCode() * 31 + Title.GetHashCode()) * 31 + PublishingHouse.GetHashCode()) * 31 +
                         Year.GetHashCode()) * 31 + Genre.GetHashCode()) * 31;

            return(hash);
        }
Example #4
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Links != null)
         {
             hashCode = hashCode * 59 + Links.GetHashCode();
         }
         if (Author != null)
         {
             hashCode = hashCode * 59 + Author.GetHashCode();
         }
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Title != null)
         {
             hashCode = hashCode * 59 + Title.GetHashCode();
         }
         if (Url != null)
         {
             hashCode = hashCode * 59 + Url.GetHashCode();
         }
         if (Class != null)
         {
             hashCode = hashCode * 59 + Class.GetHashCode();
         }
         return(hashCode);
     }
 }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (AnnotationLayout != null)
         {
             hashCode = hashCode * 59 + AnnotationLayout.GetHashCode();
         }
         hashCode = hashCode * 59 + StickyNoteIcon.GetHashCode();
         if (Author != null)
         {
             hashCode = hashCode * 59 + Author.GetHashCode();
         }
         if (Subject != null)
         {
             hashCode = hashCode * 59 + Subject.GetHashCode();
         }
         if (Content != null)
         {
             hashCode = hashCode * 59 + Content.GetHashCode();
         }
         hashCode = hashCode * 59 + OpenPopup.GetHashCode();
         if (Color != null)
         {
             hashCode = hashCode * 59 + Color.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #6
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(Author.GetHashCode() + Title.GetHashCode() + Rating.GetHashCode());
     }
 }
Example #7
0
 public override int GetHashCode()
 {
     return(Name.GetHashCode() ^
            ContentType.GetHashCode() ^
            Author.GetHashCode() ^
            Content.GetHashCode() ^
            Digest.GetHashCode());
 }
Example #8
0
 public override int GetHashCode()
 {
     unchecked {
         int result = (Body != null ? Body.GetHashCode() : 0);
         result = (result * 397) ^ (Created != null ? Created.GetHashCode() : 0);
         result = (result * 397) ^ (Author != null ? Author.GetHashCode() : 0);
         return(result);
     }
 }
Example #9
0
        public override int GetHashCode()
        {
            int hash = 17;

            hash = hash * 31 + (Id == null ? 0 : Id.GetHashCode());
            hash = hash * 31 + (Author == null ? 0 : Author.GetHashCode());
            hash = hash * 31 + (Title == null ? 0 : Title.GetHashCode());
            hash = hash * 31 + (Flair == null ? 0 : Flair.GetHashCode());
            return(hash);
        }
 public override int GetHashCode()
 {
     unchecked
     {
         int result = (Title != null ? Title.GetHashCode() : 0);
         result = (result * 397) ^ (Author != null ? Author.GetHashCode() : 0);
         result = (result * 397) ^ (Chapters != null ? Chapters.GetHashCode() : 0);
         return(result);
     }
 }
Example #11
0
        public override int GetHashCode()
        {
            int result = base.GetHashCode();

            result = (result * 397) ^ Title.GetHashCode();
            result = (result * 397) ^ Author.GetHashCode();
            result = (result * 397) ^ Isbn.GetHashCode();
            result = (result * 397) ^ Year.GetHashCode();
            return(result);
        }
Example #12
0
        public override int GetHashCode()
        {
            int hashCode = 0;

            foreach (var items in noteList)
            {
                hashCode += items.GetHashCode();
            }
            return(hashCode + Author.GetHashCode());
        }
Example #13
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()
 {
     return(Isbn.GetHashCode() ^
            Author.GetHashCode() ^
            Title.GetHashCode() ^
            Publisher.GetHashCode() ^
            PublishingYear.GetHashCode() ^
            PagesNumber.GetHashCode() ^
            Price.GetHashCode());
 }
Example #14
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Author != null ? Author.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ TimeCreated.GetHashCode();
         hashCode = (hashCode * 397) ^ TimeEdited.GetHashCode();
         return(hashCode);
     }
 }
Example #15
0
        /// <summary>
        /// Calculates hash code for current book
        /// </summary>
        /// <returns>Hash code of the book</returns>
        public override int GetHashCode()
        {
            int hashCode = 0;

            unchecked
            {
                hashCode = Title.GetHashCode() * 1 + Author.GetHashCode() * 2 + Country.GetHashCode() * 3;
            }
            return(hashCode);
        }
        /// <summary>
        /// gethashcode method? base on immutable fields of book
        /// </summary>
        /// <returns>hashcode</returns>
        public override int GetHashCode()
        {
            int hashcode = Title.GetHashCode();

            hashcode = 31 * hashcode + Author.GetHashCode();
            hashcode = 31 * hashcode + Genre.GetHashCode();
            hashcode = 31 * hashcode + Year.GetHashCode();
            hashcode = 31 * hashcode + Edition.GetHashCode();
            return(hashcode);
        }
        public override int GetHashCode()
        {
            int hash = 17;

            hash = hash * 31 + (Author == null ? 0 : Author.GetHashCode());
            hash = hash * 31 + (Body == null ? 0 : Body.GetHashCode());
            hash = hash * 31 + (Id == null ? 0 : Id.GetHashCode());
            hash = hash * 31 + (PostLinkId == null ? 0 : PostLinkId.GetHashCode());
            return(hash);
        }
Example #18
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Author != null ? Author.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Text != null ? Text.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)EntityType;
         return(hashCode);
     }
 }
 public override int GetHashCode()
 {
     unchecked
     {
         return
             ((int)
              ((Pages * Price * Author?.GetHashCode() ?? 1 * Title?.GetHashCode() ?? 1) /
               (Pages - Price - Author?.GetHashCode() ?? 1 - Title?.GetHashCode() ?? 1)));
     }
 }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Author != null ? Author.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Date.GetHashCode();
         hashCode = (hashCode * 397) ^ (Message != null ? Message.GetHashCode() : 0);
         return(hashCode);
     }
 }
Example #21
0
 public override int GetHashCode()
 {
     unchecked {
         int result = Id;
         result = (result * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         result = (result * 397) ^ Created.GetHashCode();
         result = (result * 397) ^ (Author != null ? Author.GetHashCode() : 0);
         result = (result * 397) ^ Size;
         return(result);
     }
 }
Example #22
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + Title.GetHashCode();
         hash = hash * 23 + Author.GetHashCode();
         hash = hash * 23 + ReleaseYear.GetHashCode();
         return(hash);
     }
 }
Example #23
0
        // https://stackoverflow.com/questions/371328/why-is-it-important-to-override-gethashcode-when-equals-method-is-overridden
        public override int GetHashCode()
        {
            int hash = 13;

            hash = (hash * 7) + Id.GetHashCode();
            hash = (hash * 7) + Author.GetHashCode();
            hash = (hash * 7) + Text.GetHashCode();
            hash = (hash * 7) + Date.GetHashCode();

            return(hash);
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Author?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (Title?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ Pages;
         hashCode = (hashCode * 397) ^ Price.GetHashCode();
         return(hashCode);
     }
 }
Example #25
0
        public override int GetHashCode()
        {
            int hash = 17;

            hash = hash * 31 + (Id == null ? 0 : Id.GetHashCode());
            hash = hash * 31 + (Author == null ? 0 : Author.GetHashCode());
            hash = hash * 31 + (Kind == null ? 0 : Kind.GetHashCode());
            hash = hash * 31 + (CreateDate == null ? 0 : CreateDate.GetHashCode());
            hash = hash * 31 + IsDeleted.GetHashCode();
            return(hash);
        }
 public override int GetHashCode()
 {
     unchecked {
         var hashCode = Author?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (Title?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (PublishOrganization?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ PagesNumber;
         hashCode = (hashCode * 397) ^ Price.GetHashCode();
         return(hashCode);
     }
 }
Example #27
0
        /// <summary>
        /// Calculates hash code for current book
        /// </summary>
        /// <returns>Hash code of the book</returns>
        public override int GetHashCode()
        {
            int hashCode = 0;

            unchecked
            {
                hashCode = Title.GetHashCode() + Author.GetHashCode() + Genre.GetHashCode() +
                           NumberOfPages.GetHashCode() + Language.GetHashCode() + Country.GetHashCode();
            }
            return(hashCode);
        }
 public override int GetHashCode()
 {
     unchecked
     {
         int result = (BookId != null ? BookId.GetHashCode() : 0);
         result = (result * 397) ^ (Title != null ? Title.GetHashCode() : 0);
         result = (result * 397) ^ (Author != null ? Author.GetHashCode() : 0);
         result = (result * 397) ^ (Publication != null ? Publication.GetHashCode() : 0);
         result = (result * 397) ^ (Date != null ? Date.GetHashCode() : 0);
         return(result);
     }
 }
Example #29
0
 /// <summary>
 /// Computes a hash code of the Book type object.
 /// </summary>
 /// <returns> Integer type, hash code.</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Author.GetHashCode();
         hashCode = (hashCode * 397) ^ Title.GetHashCode();
         hashCode = (hashCode * 397) ^ Genre.GetHashCode();
         hashCode = (hashCode * 397) ^ Publisher.GetHashCode();
         hashCode = (hashCode * 397) ^ NumberOfPages;
         return(hashCode);
     }
 }
Example #30
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (FullName != null ? FullName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)Type;
         hashCode = (hashCode * 397) ^ ChangedDate.GetHashCode();
         hashCode = (hashCode * 397) ^ (Author != null ? Author.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         return(hashCode);
     }
 }