From the course: Visual Basic Essential Training
Unlock this course with a free trial
Join today to access over 24,500 courses taught by industry experts.
Customize a method with predicate functions - Visual Basic Tutorial
From the course: Visual Basic Essential Training
Customize a method with predicate functions
- [Narrator] In this video, our goal is to explore how to use the FindAll function shown on line 17. This function is defined within the List<T> class. This method allows us to retrieve all the elements in the list that match a specified condition. Along the way, we'll learn more about predicate functions, delegates, and lambda expressions. So if you look at the signature of this method, its purpose is to find items based on some code that I'll provide. The signature says FindAll will return a List of Integer, and it expects me to pass in an instance of a Predicate of Integer. I've defined a function that matches the signature, up here. Now predicate, as you recall, has to return a Boolean, and the purpose is to examine one value and determine whether it should be in the results, the output. Now of course, this function only works with one number at a time, but this function will get called multiple times by the FindAll method down here. W does my code do? It takes a number as an…
Contents
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
(Locked)
Explore the collection classes10m 18s
-
(Locked)
Use a ListBox instead of a text control3m 10s
-
(Locked)
Create new collections6m 30s
-
(Locked)
Initialize a collection2m 23s
-
(Locked)
Add items to a list1m 13s
-
(Locked)
Get items from the list3m 16s
-
(Locked)
Remove items from a list1m 15s
-
(Locked)
Iterate over a list5m 20s
-
(Locked)
Bind a list to a user control5m 46s
-
(Locked)
Delegates and lambda expressions4m 36s
-
(Locked)
Customize a method with predicate functions5m 21s
-
(Locked)
Quick look at other collection classes4m 28s
-
(Locked)
-
-
-