示例#1
0
        public int CompareTo(object obj)
        {
            if (!(obj is Student st))
            {
                return(0);
            }

            var firstCompare = FirstName?.CompareTo(st.FirstName) ?? 0;

            if (firstCompare != 0)
            {
                return(firstCompare);
            }

            var secondCompare = NumberCard.CompareTo(st.NumberCard);

            return(secondCompare == 0 ? DOB.CompareTo(st.DOB) : secondCompare);
        }