Chapter 21. LINQ

LINQ (Language Integrated Query, pronounced "link") is a data selection mechanism designed to give programs the ability to select data in the same way from any data source. Ideally the program would be able to use exactly the same method to fetch data whether it's stored in arrays, lists, relational databases, XML data, Excel worksheets, or some other data store. Currently the LINQ API supports data stored in relational databases, objects within the program stored in arrays or lists, and XML data.

LINQ is a complex topic. LINQ provides dozens of extension methods that apply to all sorts of objects that hold data such as arrays, dictionaries, and lists. Visual Basic provides a LINQ query syntax that converts SQL-like queries into calls to LINQ functions.

LINQ tools are divided into the three categories summarized in the following list:

  • LINQ to Objects refers to LINQ functions that interact with Visual Basic objects such as arrays, dictionaries, and lists. Most of this chapter presents examples using these kinds of objects to demonstrate LINQ concepts.

  • LINQ to XML refers to LINQ features that read and write XML data. Using LINQ, you can easily move ...

Get Visual Basic® 2010 Programmer's Reference 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.