When we sort an Array we use Array.Sort() and when we sort ArrayList we use Sort(). Please explain the reason. Example is given below.
eg:-
Employee[] empArray = new Employee[] { new Employee(333, 12.50), new Employee(111, 14.75), new Employee(222, 22.35) };
Array.Sort(empArray);
eg:-
ArrayList people = new ArrayList(); //this requires using System.Collections;
people.Add(new Person("John", "Doe", 84));
people.Add(new Person("Abby", "Normal", 25));
people.Add(new Person("Jane", "Doe", 76));
people.Sort();
Loading
VulpesPosted Sep 16, 2013, 7:52 AM
However, the Array class (from which all arrays derive) has a static Sort method and (for the overload you're using) you pass the array object (empArray in your example) as the single parameter of this method.
Posted Sep 16, 2013, 8:00 AM