Skip to content

format

typescript
List.Sort(sort_function)

class: List

description

Sorts the elements in the list.

parameter

param_nametypedescription
sort_functionFunctionThe sorting function.

reture

typedescription
void

code example

typescript
let list = new List<Number>(Number);
list.AddRange([100, 200 , 300]);
// Sorts the elements in the list in descending order
const customSort = (a: number, b: number): number => b - a;
list.Sort(customSort);