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

Typed DataSets

Typed DataSets can be queried using LINQ, just as untyped DataSets can. However, typed DataSets make your LINQ query code simpler and easier to read. When querying a typed DataSet, because there is a class for the DataSet, you may access the table and column names using the typed DataSet object's class properties instead of indexing into the Tables collection or using the Field<T> and SetField<T> operators.

So instead of accessing a DataSet object's table named Students like this

DataTable Students = dataSet.Tables["Students"];

you can access it like this:

DataTable Students = dataSet.Students;

Instead of obtaining a field's value like this

dataRow.Field<string>("Name")

you can obtain it like this:

dataRow.Name

This certainly ...

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