ArraySort Method (Array, Array, Int32, Int32) |
Sorts a range of elements in 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
IComparable implementation of each key.
Namespace: SystemAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public static void Sort(
Array keys,
Array items,
int index,
int length
)
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. - index
- Type: SystemInt32
The starting index of the range to sort. - length
- Type: SystemInt32
The number of elements in the range to sort.
Exceptions Exception | Condition |
---|
ArgumentNullException | keys is null. |
RankException | The keysArray is multidimensional.-or-The itemsArray is multidimensional. |
ArgumentOutOfRangeException | index is less than the lower bound of keys.-or-length is less than zero. |
ArgumentException | items is not null, and the length of keys is greater than the length of items.-or-index and length do not specify a valid range in the keysArray.-or-items is not null, and index and length do not specify a valid range in the itemsArray. |
InvalidOperationException | One or more elements in the keysArray do not implement the IComparable interface. |
See Also