1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
// 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));
|