public int CompareTo(object obj) { StackHashCabCollection cabs = obj as StackHashCabCollection; if (cabs.Count != this.Count) { return(-1); } foreach (StackHashCab thisCab in this) { StackHashCab matchingCab = cabs.FindCab(thisCab.Id); if (matchingCab == null) { return(-1); } if (matchingCab.CompareTo(thisCab) != 0) { return(-1); } } // Must be a match. return(0); }
public object Clone() { StackHashCabCollection cabCollection = new StackHashCabCollection(); foreach (StackHashCab cab in this) { cabCollection.Add((StackHashCab)cab.Clone()); } return(cabCollection); }
} // Needed to serialize. public StackHashCabPackageCollection(StackHashCabCollection cabs) { if (cabs == null) { throw new ArgumentNullException("cabs"); } foreach (StackHashCab cab in cabs) { this.Add(new StackHashCabPackage(cab, null, null, true)); } }