O'Reilly logo

Microsoft® Visual Basic® 2010 Developer’s Handbook by Klaus Löffelmann and Sarika Calla Purohit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Where Method

The first example illustrates the most important extension method of the IEnumerable interface: the Where method. Because normal arrays implement IEnumerable, the Where method is available for use with these arrays. The method iterates through all the elements, calling a Predicate delegate for each element in the collection (the description of List(Of Type) in Chapter 19 contains more information). Instead of a delegate variable, you can also specify a lambda expression. If this expression evaluates to True—in other words, the corresponding condition is met—the affected element is put in a new result collection that has the generic IEnumerable type that matches the source type. In the first example, the source type is an Integer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required