ArraySortT Method (T, IComparerT) |
Sorts the elements in an
Array using the specified
IComparerT generic interface.
Namespace: SystemAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public static void Sort<T>(
T[] array,
IComparer<T> comparer
)
Parameters
- array
- Type: T
The one-dimensional, zero-base Array to sort - comparer
- Type: System.Collections.GenericIComparerT
The IComparerT generic interface implementation to use when comparing elements, or null to use the IComparableT generic interface implementation of each element.
Type Parameters
- T
- The type of the elements of the array.
Exceptions Exception | Condition |
---|
ArgumentNullException | array is null. |
InvalidOperationException | comparer is null, and one or more elements in array do not implement the IComparableT generic interface. |
ArgumentException | The implementation of comparer caused an error during the sort. For example, comparer might not return 0 when comparing an item with itself. |
See Also