示例#1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (_phone != null ? _phone.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DriverIdNum != null ? DriverIdNum.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (_name != null ? _name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)_status;
         hashCode = (hashCode * 397) ^ (int)GenderType;
         hashCode = (hashCode * 397) ^ (AbonementCurent != null ? AbonementCurent.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (string.IsNullOrEmpty(IdString) ? 0 : IdString.GetHashCode());
         hashCode = (hashCode * 397) ^ BirthDate.GetHashCode();
         hashCode = (hashCode * 397) ^ (Passport != null ? Passport.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (PathToPhoto != null ? PathToPhoto.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SpecialNotes != null ? SpecialNotes.GetHashCode() : 0);
         return(hashCode);
     }
 }
示例#2
0
        public void GetHashcodeTest()
        {
            Passport passport1 = new Passport();

            passport1.Mrz1          = "test-mrz1";
            passport1.Mrz2          = "test-mrz2";
            passport1.Number        = "test-number";
            passport1.DayOfExpiry   = 15;
            passport1.MonthOfExpiry = 3;
            passport1.YearOfExpiry  = 2000;

            Passport passport2 = new Passport();

            passport2.Mrz1          = "test-mrz1";
            passport2.Mrz2          = "test-mrz2";
            passport2.Number        = "test-number";
            passport2.DayOfExpiry   = 15;
            passport2.MonthOfExpiry = 3;
            passport2.YearOfExpiry  = 2000;

            Assert.Equal(passport1.GetHashCode(), passport2.GetHashCode());
        }