ListTSort Method (Int32, Int32, IComparerT) |
Sorts the elements in a range of elements in
ListT using the specified comparer.
Namespace: System.Collections.GenericAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public void Sort(
int index,
int count,
IComparer<T> comparer
)
Parameters
- index
- Type: SystemInt32
The zero-based starting index of the range to sort. - count
- Type: SystemInt32
The length of the range to sort. - comparer
- Type: System.Collections.GenericIComparerT
The IComparerT implementation to use when comparing elements, or null to use the default comparer Default.
Exceptions Exception | Condition |
---|
ArgumentOutOfRangeException | index is less than 0.-or-count is less than 0. |
ArgumentException | index and count do not specify a valid range in the ListT.-or-The implementation of comparer caused an error during the sort. For example, comparer might not return 0 when comparing an item with itself. |
InvalidOperationException | comparer is null, and the default comparer Default cannot find implementation of the IComparableT generic interface or the IComparable interface for type T. |
See Also