예제 #1
0
 /// <summary>
 /// Polymorphic method that computes the maximum value of any pair of IComparable objects
 /// </summary>
 /// <returns>The greatest object</returns>
 static IComparable Max(IComparable a, IComparable b)
 {
     return(a.Compare(b) > 0 ? a : b);
 }
 pulbic int ComparePerson(Person person, IComparable comparer)
 {
     return(comparer.Compare(this, person));
 }
예제 #3
0
 public static object Largest(IComparable a, IComparable b)// this method will work with all classes that implement IComparable regardless of their type
 {
     return((a.Compare(b) > 0) ? a : b);
 }