Sorts the elements in the specified range of the current instance using the specified IComparer implementation.
- index
- A int that specifies the zero-based index at which sorting starts. This value is between 0 and the ArrayList.Count of the current instance minus count , inclusive.
- count
- A int that specifies the number of elements to sort. This value is between 0 and the ArrayList.Count of the current instance minus index , inclusive.
- comparer
- The IComparer implementation to use when comparing elements. Specify null to use the IComparable implementation of each element in the current instance.
Type Reason ArgumentOutOfRangeException index < 0.
-or-
count < 0.
ArgumentException ArrayList.Count of the current instance - index < count. InvalidCastException comparer is null, and one or more elements in the current instance do not implement the IComparable interface. NotSupportedException The current instance is read-only. InvalidOperationException comparer is null, and one or more elements in the current instance do not implement the IComparable interface.
Operation
As described above.If comparer is null, the IComparable implementation of each element in the current instance is used to make the sorting comparisons. If the sort is not successfully completed, the results are unspecified.
Note: For the default implementation, this method uses Array.Sort(Array), which uses the Quicksort algorithm. This is an O(n log2n) operation, where n is the number of elements to sort.
Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0