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.
Iterate over list - Visual Basic Tutorial
From the course: Visual Basic Essential Training
Iterate over list
- [Instructor] It's time to look at the for each looping keywords. Essential for each let's us loop through a collection of items and work with each item in the list. To make this work .net has two important interfaces. I'll show examples in this class diagram, ClassDiagram1.cd. Which I've added to the Visual Studio project. It allows us to visualize .net types and is available as an extra component in the Visual Studio installer. This shows the two important interfaces IEnumerable and IEnumerable(Of T). If a type implements either one of these interfaces you can for each over the items in that collection. I'm showing three example items. I've got list of T, which implements both the interfaces. I've got the array class, which implements IEnumerable and here's a type that I'll use later in this chapter called SortedSet. And it implements both IEnumerable(Of T) and Ienumerable. Let's switch over to the code. My first…
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)
-
-