6.11. Query Data from Multiple Collections


You need to execute a query based on the combined data from multiple collections.


Create a standard LINQ query, such as the ones described by the previous recipes in this chapter, and use the Join clause to join the data from multiple sources.

How It Works

If you have any experience with SQL, or other query languages, you will most likely recognize the need to join data from multiple sources. One of the most popular join functions available to Microsoft T-SQL is INNER JOIN, which returns only the elements from the first source that match elements in the second.

The.NET Framework 3.5 supplies the Join clause, which provides functionality equivalent to an inner join. Here is an example: ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.