/// <summary> /// Returns a new ArrayList with all items of the tree, sorted by pOrderMethod delegate. /// The delegate must adhere to the ICompare rules: /// Return -1 if item1 < item2. /// Return 0 if item1 == item2. /// Return 1 if item1 > item2. /// </summary> /// <param name="pOrderMethod">Delegate used to sort the arrayList</param> /// <returns>The ArrayList with the contents of the tree</returns> public virtual ArrayList ToArrayList(OrderItemDelegate pOrderMethod) { ArrayList arr = ToArrayList(); // Bubble-sort the ArrayList using pOrderMethod. if (pOrderMethod != null) { arr.Sort(new UnorderedTreeComparer(pOrderMethod)); } return(arr); }
internal UnorderedTreeComparer(OrderItemDelegate pOrderMethod) { _pMethod = pOrderMethod; }