LINQ Examples
To understand why LINQ is revolutionary, the best way is beginning with some code examples. In the next chapters you get a huge quantity of code snippets, but this chapter offers basic queries to provide a high-level comprehension. Imagine you have a Person
class exposing the FirstName
, LastName
, and Age
properties. Then, imagine you have a collection of Person
objects, of type List(Of Person)
. Last, imagine you want to extract from the collection all Person
instances whose LastName
property begins with the D
letter. This scenario is accomplished via the following code snippet that uses a LINQ query:
This form of code is known ...
Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.