示例#1
0
 public override bool Equals(System.Object otherItem)
 {
     if (!(otherItem is Book))
     {
         return(false);
     }
     else
     {
         Book newBook    = (Book)otherItem;
         bool idEquality = (this.GetId() == newBook.GetId());
         bool titleEq    = (this.GetTitle() == newBook.GetTitle());
         bool yearEq     = (this.GetYear() == newBook.GetYear());
         return(idEquality && titleEq && yearEq);
     }
 }
示例#2
0
 public override bool Equals(System.Object otherBook)
 {
     if (!(otherBook is Book))
     {
         return(false);
     }
     else
     {
         Book newBook           = (Book)otherBook;
         bool areIdsEqual       = (this.GetId() == newBook.GetId());
         bool areNameEqual      = (this.GetName() == newBook.GetName());
         bool areauthor_idEqual = (this.GetAuthorId() == newBook.GetAuthorId());
         bool areYearEqual      = (this.GetYear() == newBook.GetYear());
         return(areIdsEqual && areNameEqual && areauthor_idEqual && areYearEqual);
     }
 }