示例#1
0
        public override int GetHashCode()
        {
            // https://www.loganfranken.com/blog/692/overriding-equals-in-c-part-2/
            unchecked
            {
                const int hashingBase       = (int)2166136261;
                const int hashingMultiplier = 16777619;

                int hash = hashingBase;
                hash = (hash * hashingMultiplier) ^
                       (!ReferenceEquals(null, SubjectName) ? SubjectName.GetHashCode() : 0);
                hash = (hash * hashingMultiplier) ^
                       (!ReferenceEquals(null, TeacherName) ? TeacherName.GetHashCode() : 0);
                hash = (hash * hashingMultiplier) ^
                       (!ReferenceEquals(null, ClassType) ? ClassType.GetHashCode() : 0);
                hash = (hash * hashingMultiplier) ^
                       (!ReferenceEquals(null, DayOfWeek) ? DayOfWeek.GetHashCode() : 0);
                hash = (hash * hashingMultiplier) ^
                       (!ReferenceEquals(null, TimeSegmentStart) ? TimeSegmentStart.GetHashCode() : 0);
                hash = (hash * hashingMultiplier) ^
                       (!ReferenceEquals(null, TimeSegmentCount) ? TimeSegmentCount.GetHashCode() : 0);

                return(hash);
            }
        }
示例#2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ Group;
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Email != null ? Email.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TeacherName != null ? TeacherName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Absences;
         hashCode = (hashCode * 397) ^ JustifiedAbsences;
         return(hashCode);
     }
 }