Skip to content

format

typescript
List.Insert(index, item)

class: List

description

Inserts an element at the specified index position in the list.

parameter

param_nametypedescription
indexnumberThe index value.
itemTThe element value.

reture

typedescription
void

code example

typescript
let list = new List<Number>(Number);
list.AddRange([100, 200]);
 //Inserts the value 300 at index position 2       
list.Insert(2,300);

for (let index = 0; index < list.count; index++) {
    Debug.Log(list.get(index));
}