//Override GetHashCode() public override int GetHashCode() //https://docs.microsoft.com/en-us/dotnet/api/system.object.gethashcode?view=netframework-4.8 { return(FirstName.GetHashCode() ^ MiddleName.GetHashCode() ^ LastName.GetHashCode() ^ SSN.GetHashCode()); //https://www.tutorialspoint.com/csharp/csharp_operators.htm Binary XOR Operator copies the bit if it is set in one operand but not both. (A ^ B) = 49, which is 0011 0001 }
public override int GetHashCode() { // using prime numbers to multiply int hash = 29; int hashMultiplier = 11; // overflow is ok for hashing unchecked { // use multyplying and the fields' own hashcode to generate a unique code for the student hash = hash * hashMultiplier + string.Format("{0} {1} {2}", FirstName, MiddleName, LastName).GetHashCode(); hash = hash * hashMultiplier + Adress.GetHashCode(); hash = hash * hashMultiplier + Course.GetHashCode(); hash = hash * hashMultiplier + Email.GetHashCode(); hash = hash * hashMultiplier + Faculty.GetHashCode(); hash = hash * hashMultiplier + Phone.GetHashCode(); hash = hash * hashMultiplier + SSN.GetHashCode(); hash = hash * hashMultiplier + University.GetHashCode(); hash = hash * hashMultiplier + Specialty.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 13; Random rand = new Random(); hash = (hash * 7) + SSN.GetHashCode(); hash = (hash * rand.Next(1, 1000)); hash = (hash * counter); return(hash); }
public override int GetHashCode() { return(FirstName.GetHashCode() ^ MiddleName.GetHashCode() ^ LastName.GetHashCode() ^ SSN.GetHashCode() ^ PermanentAddress.GetHashCode() ^ MobilePhoneNr.GetHashCode() ^ Email.GetHashCode() ^ Course.GetHashCode() ^ Speciality.GetHashCode() ^ University.GetHashCode() ^ Faculty.GetHashCode()); }
public override int GetHashCode() { int hash = 29; int hashMultiplier = 11; unchecked { hash = hash * hashMultiplier + string.Format("{0} {1} {2}", FirstName, MiddleName, LastName).GetHashCode(); hash = hash * hashMultiplier + Adress.GetHashCode(); hash = hash * hashMultiplier + Course.GetHashCode(); hash = hash * hashMultiplier + Email.GetHashCode(); hash = hash * hashMultiplier + Faculty.GetHashCode(); hash = hash * hashMultiplier + Phone.GetHashCode(); hash = hash * hashMultiplier + SSN.GetHashCode(); hash = hash * hashMultiplier + University.GetHashCode(); hash = hash * hashMultiplier + Specialty.GetHashCode(); } return(hash); }
public override int GetHashCode() { var hashCode = -684685926; hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(LastName); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(FirstName); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(MidlleName); hashCode = hashCode * -1521134295 + SSN.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Adress); hashCode = hashCode * -1521134295 + MobilePhone.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Email); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Course); hashCode = hashCode * -1521134295 + Specialitate.GetHashCode(); hashCode = hashCode * -1521134295 + Universitate.GetHashCode(); hashCode = hashCode * -1521134295 + Facultate.GetHashCode(); return(hashCode); }
public override int GetHashCode() { return(LastName.GetHashCode() ^ SSN.GetHashCode() ^ Mobile.GetHashCode()); }
public override int GetHashCode() { int hash = SSN.GetHashCode(); return(31 * hash); }
public override int GetHashCode() { return(FirstName.GetHashCode() ^ SSN.GetHashCode()); }
public override int GetHashCode() { return(SSN.GetHashCode() ^ PermanentAddress.GetHashCode()); }
public override int GetHashCode() { return(SSN.GetHashCode()); }
public override int GetHashCode() { return(FirstName.GetHashCode() ^ MiddleName.GetHashCode() ^ LastName.GetHashCode() ^ SSN.GetHashCode() ^ Phone.GetHashCode()); }
public override int GetHashCode() { return(Name.GetHashCode() ^ SSN.GetHashCode() & Email.GetHashCode()); }