将项添加到列表

Dim aList as New List(Of Integer)
aList.Add(1)
aList.Add(10)
aList.Add(1001)

要一次添加多个项目,请使用 AddRange 。始终添加到列表的末尾

Dim blist as New List(of Integer)
blist.AddRange(alist) 

Dim aList as New List(of String)
alist.AddRange({"one", "two", "three"}) 

要将项目添加到列表中间,请使用“ 插入”

Insert 会将项目放在索引处,并重新编号其余项目

Dim aList as New List(Of String)
aList.Add("one")
aList.Add("three")
alist(0) = "one"
alist(1) = "three"
alist.Insert(1,"two")

新产出:

alist(0) = "one"       
alist(1) = "two"
alist(2) = "three"