示例#1
0
文件: Lesson.cs 项目: Alberty7/Dipper
 public int CompareTo(object obj)
 {
     if (obj is Subject other)
     {
         return(LessonName.CompareTo(other.LessonName) ^ Teacher.CompareTo(other.Teacher));
     }
     else
     {
         throw new Exception("Несравнимые объекты");
     }
 }
示例#2
0
文件: Lesson.cs 项目: Alberty7/Dipper
    public new int CompareTo(object obj)
    {
        switch (obj)
        {
        case Lesson other:
            return(LessonName.CompareTo(other.LessonName) + Teacher.CompareTo(other.Teacher) + StartLesson.CompareTo(other.StartLesson) + FinishLesson.CompareTo(other.FinishLesson) + NameGroup.CompareTo(other.NameGroup) + NumberGroup.CompareTo(other.NumberGroup));

        default:
            throw new Exception("Несравнимые объекты");
        }
    }
 public override int GetHashCode()
 {
     return(LessonName != null?LessonName.GetHashCode() : 0);
 }