Skip to content

M_CodeJam_Collections_ArrayExtensions_Sort__1_3

Andrew Koryavchenko edited this page Jun 17, 2018 · 7 revisions

ArrayExtensions.Sort(T) Method (T[], Int32, Int32)

Sorts the elements in a range of elements in an Array using the IComparable(T) generic interface implementation of each element of the Array.

Namespace: CodeJam.Collections
Assembly: CodeJam (in CodeJam.dll) Version: 2.1.0.0

Syntax

C#

public static void Sort<T>(
	this T[] array,
	int index,
	int length
)

VB

<ExtensionAttribute>
Public Shared Sub Sort(Of T) ( 
	array As T(),
	index As Integer,
	length As Integer
)

F#

[<ExtensionAttribute>]
static member Sort : 
        array : 'T[] * 
        index : int * 
        length : int -> unit 

Parameters

 

array
Type: T[]
The one-dimensional, zero-based Array to sort
index
Type: System.Int32
The starting index of the range to sort.
length
Type: System.Int32
The number of elements in the range to sort.

Type Parameters

 

T
The type of the elements of the array.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type . When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

 

Exception Condition
ArgumentNullException array is null.
ArgumentOutOfRangeException index is less than the lower bound of array.-or-length is less than zero.
ArgumentException index and length do not specify a valid range in array.
InvalidOperationException One or more elements in array do not implement the IComparable(T) generic interface.

See Also

Reference

ArrayExtensions Class
Sort Overload
CodeJam.Collections Namespace

Clone this wiki locally