Chapter 11. LINQ

Probably the biggest and most exciting addition to the .NET Framework 3.5 is the addition of the .NET Language Integrated Query Framework (LINQ) into Visual Basic 2008. Basically, what LINQ provides is a lightweight façade over programmatic data integration. This is a big deal, because data is king.

Pretty much every application deals with data in some manner, whether that data comes from memory (in-memory data), databases, XML files, text files, or somewhere else. Many developers find it very difficult to move from the strongly typed, object-oriented world of Visual Basic to the data tier, where objects are second-class citizens. The transition from the one world to the next was a kludge at best and full of error-prone actions.

In VB, programming with objects means a wonderful, strongly typed ability to work with code. You can navigate very easily through the namespaces, work with a debugger in the Visual Studio IDE, and more. However, when you have to access data, you will notice that things are dramatically different.

You end up in a world that is not strongly typed, and debugging is a pain or even nonexistent. You end up spending most of the time sending strings to the database as commands. As a developer, you also have to be aware of the underlying data and how it is structured or how all the data points relate.

Microsoft has provided LINQ as a lightweight façade that provides a strongly typed interface to the underlying data stores. LINQ provides the means for ...

Get Professional Visual Basic® 2008 now with O’Reilly online learning.

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