コード例 #1
0
 public int CompareTo(Employee other)
 {
     if (other != null)
     {
         return(Salary.CompareTo(other.Salary));
     }
     else
     {
         throw new ArgumentException("Object is not a Employee");
     }
 }
コード例 #2
0
        public int CompareTo(Developer other)
        {
            // int intSeniority = (int)Seniority;
            int firstIsbetter = 1;

            if (Seniority.CompareTo(other.Seniority) <= 0)
            {
                if (Seniority.CompareTo(other.Seniority) < 0)
                {
                    firstIsbetter = -1;
                }
                else if (Salary.CompareTo(other.Salary) < 0)
                {
                    firstIsbetter = 1;
                }
            }
            return(firstIsbetter);
        }
コード例 #3
0
 public int CompareTo(WorkerBase other)
 {
     return(-Salary.CompareTo(other.Salary));
 }