format
typescript
List.Sort(sort_function)class: List
description
Sorts the elements in the list.
parameter
| param_name | type | description |
|---|---|---|
| sort_function | Function | The sorting function. |
reture
| type | description |
|---|---|
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);