Click or drag to resize
ArraySort Method (Array, Array, IComparer)
Sorts a pair of one-dimensional Array objects (one contains the keys and the other contains the corresponding items) based on the keys in the first Array using the specified IComparer.

Namespace: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public static void Sort(
	Array keys,
	Array items,
	IComparer comparer
)

Parameters

keys
Type: SystemArray
The one-dimensional Array that contains the keys to sort.
items
Type: SystemArray
The one-dimensional Array that contains the items that correspond to each of the keys in the keysArray.-or-null to sort only the keysArray.
comparer
Type: System.CollectionsIComparer
The IComparer implementation to use when comparing elements.-or-null to use the IComparable implementation of each element.
Exceptions
ExceptionCondition
ArgumentNullExceptionkeys is null.
RankExceptionThe keysArray is multidimensional.-or-The itemsArray is multidimensional.
ArgumentExceptionitems is not null, and the length of keys is greater than the length of items. -or-The implementation of comparer caused an error during the sort. For example, comparer might not return 0 when comparing an item with itself.
InvalidOperationExceptioncomparer is null, and one or more elements in the keysArray do not implement the IComparable interface.
See Also