/// <summary> /// Метод возвращает хэш-код объекта. /// </summary> /// <returns>Хэш-код объекта.</returns> public override int GetHashCode() { return (CarAge.GetHashCode() + DrivingExperience.GetHashCode() + DriverAge.GetHashCode() + EnginePower.GetHashCode()); }
public override int GetHashCode() { unchecked { // Choose large primes to avoid hashing collisions const int HashingBase = (int)2166136261; const int HashingMultiplier = 16777619; int hash = HashingBase; hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, DriverAge) ? DriverAge.GetHashCode() : 0); hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, Relationship) ? Relationship.GetHashCode() : 0); hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, StudentStatus) ? StudentStatus.GetHashCode() : 0); hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, Violations) ? Violations.GetHashCode() : 0); hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, DriverGPA) ? DriverGPA.GetHashCode() : 0); hash = (hash * HashingMultiplier) ^ (!Object.ReferenceEquals(null, MaritalStatus) ? MaritalStatus.GetHashCode() : 0); return(hash); } }