示例#1
0
        public override bool Equals(object obj)
        {
            if (obj is Source source)
            {
                if (source.TitleFormatted.ToLower() == TitleFormatted.ToLower() &&
                    source.AuthorsFormatted.ToLower() == AuthorsFormatted.ToLower() &&
                    source.PublishYearFormatted.ToLower() == PublishYearFormatted.ToLower())
                {
                    return(true);
                }

                else
                {
                    return(false);
                }
            }

            else
            {
                return(false);
            }
        }
示例#2
0
        /* ************************************************
         * ************************************************
         */


        /* ************************************************
         * EQUALS AND HASHCODE METHODS
         * ************************************************
         */
        // A Source is different if its Title, Author, or Publish Date is different
        // Because of this, those values will be compared in GetHashCode and Equals
        public override int GetHashCode()
        {
            return(TitleFormatted.ToLower().GetHashCode() +
                   AuthorsFormatted.ToLower().GetHashCode() * 3 +
                   PublishYearFormatted.GetHashCode());
        }