From the course: Visual Basic Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Add, remove, and interact with items from list - Visual Basic Tutorial
From the course: Visual Basic Essential Training
Add, remove, and interact with items from list
- [Instructor] Some of the most common actions with generic lists are adding, removing, and accessing items in the list. By design a newly instantiated list contains zero items. That means the items I'm showing her on line eight and line nine, these two lists of Strings, contain zero items until I explicitly add an item to the list. There is a way to initialize the list when creating it by using the initializer syntax. That looks like this. After the new list of String type in an open and closed paranthesy and inside that an open and closed curly brace. Then you'll use a comma delimited list of items. I'm using a list of String, so inside the curly braces I'll use a delimited list of Strings like this. I've already got a breakpoint on line six. Let's see what this looks like. I'll hit my breakpoint by clicking on the Initialize button and step through my code by pressing F11 until I get down to this line, and you'll…
Contents
-
-
-
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Explore the collection classes5m 44s
-
(Locked)
Create new collections4m 49s
-
(Locked)
Add, remove, and interact with items from list8m 37s
-
(Locked)
Iterate over list5m 39s
-
(Locked)
Interesting list properties4m 42s
-
(Locked)
Work with extension methods2m 40s
-
(Locked)
Use LINQ with lists5m 14s
-
(Locked)
Quick look at other collection classes2m 19s
-
(Locked)
Challenge: Marble draw with lists3m 32s
-
(Locked)
Solution: Marble draw with lists4m 41s
-
(Locked)
-
-