RemoveAt() public method

public RemoveAt ( int index ) : void
index int
return void
Example #1
0
            private ListBox.ObjectCollection quicksort(ListBox.ObjectCollection list)
            {
                ListBox.ObjectCollection sorted = new ListBox.ObjectCollection(new ListBox());
                sorted.AddRange(list);

                if(sorted.Count <= 1)
                    return sorted;

                int random = randomNumberGenerator.Next(0, sorted.Count - 1);

                string pivot = (string)list[random];
                sorted.RemoveAt(random);

                ListBox.ObjectCollection lessThan = new ListBox.ObjectCollection(new ListBox());
                ListBox.ObjectCollection greaterThan = new ListBox.ObjectCollection(new ListBox());

                for(int i = 0; i < sorted.Count; ++i)
                    sortItem(sorted[i], pivot, lessThan, greaterThan);

                sorted = quicksort(lessThan);
                sorted.Add(pivot);
                sorted.AddRange(quicksort(greaterThan));

                return sorted;
            }