예제 #1
0
 int IComparable.CompareTo(object obj)
 {
     if (obj is Student)
     {
         return(Surname.CompareTo((obj as Student).Surname));
     }
     throw new NotImplementedException();
 }
예제 #2
0
 public int CompareTo(Module other)
 {
     if (other == null)
     {
         return(1);
     }
     if (Name == other.Name)
     {
         return(0 - Surname.CompareTo(other.Surname));
     }
     return(0 - Name.CompareTo(other.Name));
 }
예제 #3
0
 public int CompareTo(ContactData other)
 {
     if (Object.ReferenceEquals(other, null))
     {
         return(1);
     }
     if (Surname.CompareTo(other.Surname) != 0)
     {
         return(Surname.CompareTo(other.Surname));
     }
     return(Name.CompareTo(other.Name));
 }
예제 #4
0
파일: Doctor.cs 프로젝트: GIM13/C-Sharp-OOP
        public int CompareTo(Doctor other)
        {
            if (Name.CompareTo(other.Name) != 0)
            {
                return(1);
            }
            else if (Surname.CompareTo(other.Surname) != 0)
            {
                return(1);
            }

            return(0);
        }
예제 #5
0
 public int CompareTo(Residents nextResident)
 {
     if (nextResident == null)
     {
         return(1);
     }
     if (Name == nextResident.Name)
     {
         return(Surname.CompareTo(nextResident.Surname));
     }
     else
     {
         return(Name.CompareTo(nextResident.Name));
     }
 }
예제 #6
0
 public int CompareTo(object o)
 {
     if (o == null)
     {
         return(1);
     }
     if (o is StudentBSUIR p)
     {
         return(Surname.CompareTo(p.Surname));
     }
     else
     {
         throw new Exception("Невозможно сравнить два объекта");
     }
 }
예제 #7
0
        public int CompareTo(ContactData other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(1);
            }

            int compareResult = Surname.CompareTo(other.Surname);

            if (compareResult == 0)
            {
                return(Name.CompareTo(other.Name));
            }

            return(compareResult);
        }
예제 #8
0
        public int CompareTo(ContactData other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(1);
            }

            int temp = Surname.CompareTo(other.Surname);

            if (temp == 0)
            {
                return(Name.CompareTo(other.Name));
            }
            else
            {
                return(temp);
            }
        }
예제 #9
0
 public int CompareTo(Student anotherStudent)
 {
     if (anotherStudent == null)
     {
         return(-1);
     }
     else
     {
         int cmpSurname = Surname.CompareTo(anotherStudent.Surname);
         if (cmpSurname == 0)
         {
             int cmpFirstname = FirstName.CompareTo(anotherStudent.FirstName);
             return(cmpFirstname != 0 ? cmpFirstname : ID.CompareTo(anotherStudent.ID));
         }
         else
         {
             return(cmpSurname);
         }
     }
 }
예제 #10
0
 public int CompareTo(Person other)
 {
     return(Surname.CompareTo(other.Surname));
 }
예제 #11
0
 /// <summary>
 /// Checks if a player object comes before, after or at the same position as the other object
 /// when sorting
 /// </summary>
 /// <param name="other">other player to compare to</param>
 /// <returns>negative number if this player's sorting order if before another object,
 /// 0 if this player's sorting order is the same as the other player's,
 /// positive number if this player's sorting order is after the other player's</returns>
 public int CompareTo(Player other)
 {
     return(Surname.CompareTo(other.Surname) == 0 ? Name.CompareTo(other.Name)
         : Surname.CompareTo(other.Surname));
 }
예제 #12
0
 //для сортировки по фамилии
 public int CompareTo(Visitor obj)
 {
     return(Surname.CompareTo(obj.Surname));
 }
예제 #13
0
        public int CompareTo(object obj)
        {
            Employee tmp = (Employee)obj;

            return(Surname.CompareTo(tmp.Surname));
        }
예제 #14
0
 public int CompareTo(Employee obj)
 {
     return(Surname.CompareTo(obj.Surname));
 }