This topic provides code samples of how to work with lists.
-
Initializes a new list of strings
myList = new list(Of String)
-
Initializes a new list of string arrays
myList = new list(Of String())
-
Sets the first item in the list
myList(0) = "Hello"
-
Gets the sixth item in the list
mySpecialString = myList(5)
-
Adds "Hello" to the end of the list
Add("Hello")
-
Inserts "Hello" after the third item
Insert(3, "Hello")
-
Returns the index of the "Hello" item
myIndex = myList.IndexOf("Hello")
-
Checks if the list contains the item "Hello" and returns true or false
doesContain = myList.Contains("Hello")
-
Gets the number of items in the list
myListCount = myList.Count