Sort and search an ArrayList.
// You must include System.Collections
ArrayList Al = new ArrayList();
// Add elements to the array list
Al.Add(23);
Al.Add(443);
Al.Add(-254);
Al.Add(-988);
Al.Add(421);
// Sort the array list
Al.Sort();
// Search in the array list
MessageBox.Show("Index of 443 is " + Al.BinarySearch(443));
Kommentare zum Snippet