Union Operators

You often need to create sequences or collections with items taken from different data sources. If you consider the example in the previous “Grouping Operators” section, it would be interesting to create a collection of objects in which the category name is also available so that the result can be more human-readable. This is possible in LINQ using union operators (not to be confused with the union Set operator keyword), which perform operations that you know as joining. To complete the following steps, simply recall the previously provided implementation of the Product and Category classes and the code that populates new collections of products and categories. The goal of the first example is to create a new sequence of products ...

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.