NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Array.Sort (Array, Int32, Int32, IComparer)

Sorts the elements in a section of a one-dimensional Array, using the specified IComparer interface.

[Visual Basic]
Overloads Public Shared Sub Sort( _
   ByVal array As Array, _
   ByVal index As Integer, _
   ByVal length As Integer, _
   ByVal comparer As IComparer _
)
[C#]
public static void Sort(
   Array array,
   int index,
   int length,
   IComparer comparer
);
[C++]
public: static void Sort(
   Array* array,
   int index,
   int length,
   IComparer* comparer
);
[JScript]
public static function Sort(
   array : Array,
   index : int,
   length : int,
   comparer : IComparer
);

Parameters

array
The one-dimensional Array to sort.
index
The starting index of the range to sort.
length
The number of elements in the range to sort.
comparer
The IComparer implementation to use when comparing elements.

-or-

a null reference (in Visual Basic Nothing) to use the IComparable implementation of each element.

Return Value

None.

Exceptions

Exception Type Condition
ArgumentNullException array is a null reference (Nothing).
RankException array is multidimensional.
ArgumentOutOfRangeException index is less than the lower bound of array.

-or-

length is less than zero.

ArgumentException index and length do not denote a valid range in array.
InvalidCastException comparer is a null reference (Nothing), and one or more elements in array does not implement the IComparable interface.

Remarks

If comparer is a null reference (Nothing), each element within the specified section of array must implement the IComparable interface to be capable of comparisons with every other element in array.

See Also

Array Class | Array Members | System Namespace | Array.Sort Overload List | IComparer | IComparable | BinarySearch