コード例 #1
0
 public int CompareTo(BillTracker other)
 {
     if (other == null)
     {
         return(1);
     }
     else
     {
         return(CompanyName.CompareTo(other.CompanyName));
     }
 }
コード例 #2
0
        public int CompareTo(Object obj) //implementation of CompareTo
        {                                // for IComparable
            Company other = (Company)obj;

            return(CompanyName.CompareTo(other.CompanyName)); //uses CompanyName for comparison
        }