public int CompareTo(StackHashCabPackageCollection other) { if (other == null) { throw new ArgumentNullException("other"); } if (other.Count != this.Count) { return(-1); } foreach (StackHashCabPackage thisCab in this) { StackHashCabPackage matchingCab = other.FindCab(thisCab.Cab.Id); if (matchingCab == null) { return(-1); } if (matchingCab.CompareTo(thisCab) != 0) { return(-1); } } // Must be a match. return(0); }