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 ...

Get Pro LINQ: Language Integrated Query in C# 2008 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.