System::Array::Sort 方法

Array::Sort(const ArrayPtr<TKey>&, const ArrayPtr<TValue>&) method

对两个数组进行排序,一个包含键,另一个包含相应的项,排序依据键数组的值,键数组的元素使用 operator< 进行比较。

template<typename TKey,typename TValue> static void System::Array<T>::Sort(const ArrayPtr<TKey> &keys, const ArrayPtr<TValue> &items)
Parameter描述
TKeykeys 数组中元素的类型
TValueitems 数组中元素的类型
ParameterType描述
keysconst ArrayPtr<TKey>&Array 包含键值的数组
itemsconst ArrayPtr<TValue>&Array 包含映射到 keys 数组中键值的项的数组

另见

Array::Sort(const ArrayPtr<TKey>&, const ArrayPtr<TValue>&, int, int) method

对两个数组进行排序,一个包含键,另一个包含相应的项,排序依据键数组的值,键数组的元素使用默认比较器进行比较。

template<typename TKey,typename TValue> static void System::Array<T>::Sort(const ArrayPtr<TKey> &keys, const ArrayPtr<TValue> &items, int index, int length)
Parameter描述
TKeykeys 数组中元素的类型
TValueitems 数组中元素的类型
ParameterType描述
keysconst ArrayPtr<TKey>&Array 包含键值的数组
itemsconst ArrayPtr<TValue>&Array 包含映射到 keys 数组中键值的项的数组
索引int用于指定要排序范围起始位置的索引
lengthint要排序范围内的元素数量

另见

Array::Sort(const ArrayPtr<Type>&) method

使用默认比较器对指定数组中的元素进行排序。

template<typename Type> static void System::Array<T>::Sort(const ArrayPtr<Type> &arr)
ParameterType描述
arrconst ArrayPtr<Type>&目标数组

另见

Array::Sort(const ArrayPtr<Type>&, const SharedPtr<System::Collections::Generic::IComparer<T>>&) method

使用指定比较器对指定数组中的元素进行排序。

template<typename Type> static void System::Array<T>::Sort(const ArrayPtr<Type> &arr, const SharedPtr<System::Collections::Generic::IComparer<T>> &comparator)
ParameterType描述
arrconst ArrayPtr<Type>&目标数组
比较器const SharedPtr<System::Collections::Generic::IComparer<T>>&用于比较数组元素的 IComparer 对象

另见

Array::Sort(const ArrayPtr<Type>&, const SharedPtr<System::Collections::Generic::IComparer<Y>>&) method

未实现。

template<typename Type,typename Y> static void System::Array<T>::Sort(const ArrayPtr<Type> &arr, const SharedPtr<System::Collections::Generic::IComparer<Y>> &comparator)

另见

Array::Sort(const ArrayPtr<Type>&, int, int) method

使用默认比较器对指定数组中的一段元素进行排序。

template<typename Type> static void System::Array<T>::Sort(const ArrayPtr<Type> &arr, int startIndex, int count)
ParameterType描述
arrconst ArrayPtr<Type>&目标数组
startIndexint用于指定要排序的元素范围起始位置的索引
countint要排序的元素范围的大小

另见