IArrayList.SortRange

Syntax

SortRange(Index: Integer; Count: Integer; Comparer: IComparer);

Parameters

Index. Index of the element, from which the range starts.

Count. Number of range elements.

Comparer. An object that compares array elements.

Description

The SortRange method sorts an array range.

Example

Sub UserProc;
Var
    ArrayL: IArrayList;
    i: Integer;
Begin
    ArrayL := New ArrayList.Create;
    For i := 0 To Math.RandBetweenI(50100Do
        ArrayL.Add(Math.RandBetweenI(0100));
    End For;
    ArrayL.SortRange(10, ArrayL.Count - 20, Comparer.IntegerComparer);
End Sub UserProc;

After executing the example a dynamic array of random numbers is generated, and the middle part of array, except for the first and last 10 elements, is sorted in ascending order.

See also:

IArrayList