ArrayList.Sort Method (IComparer)
Sorts the elements in the entire ArrayList using the specified comparer.
Assembly: mscorlib (in mscorlib.dll)
abstract Sort : comparer:IComparer -> unit override Sort : comparer:IComparer -> unit
Use the Sort method to sort a list of objects with a custom comparer that implements the IComparer interface. If you pass a null reference (Nothing in Visual Basic) for comparer, this method uses the IComparable implementation of each element. In this case, you must make sure that the objects contained in the list implement the IComparer interface or an exception will occur.
In addition, using the IComparable implementation means the list performs a comparison sort (also called an unstable sort); that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal. To perform a stable sort, you must implement a custom IComparer interface.
On average, this method is an O(n log n) operation, where n is Count; in the worst case it is an O(n^2) operation.
Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.