O'Reilly logo

Pro LINQ: Language Integrated Query in C# 2008 by Joseph C. Rattz Jr.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Common Code for the Examples

Virtually every example in this chapter will require a DataTable object on which to perform LINQ to DataSet queries. In real production code, you would typically obtain these DataTable objects by querying a database. However, for some of these examples, I present situations where the data conditions in a typical database table will not suffice. For example, I need duplicate records to demonstrate the Distinct method. Rather than jump through hoops trying to manipulate the database to contain the data I may need, I programmatically create a DataTable containing the specific data I desire for each example. This also relieves you of the burden of having a database for testing the majority of these examples.

Since I ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required