LINQ over untyped DataSets

This example comes from the AppDev (Exploring Visual Studio 2008 Using Visual C#)


DataSetr ds = FillDataset();
DataTable customerTable = ds.Tables["Customers"];

// DataTable does not implement IEnumerable
var cutomers = from c in customerTable.AsEnumerable()
where c.Field("Country") == "USA"
select new
{
CustomerID = c.Field("CustomerID"),
ContractName = c.Field("ContractName")
{;

Lambda Expression and LINQ Extension

As I learn more about LINK I hope these things become more of an automatic choice rather than keeping notes… but for now I am stil new to LINQ:

You can use two different ways to retrieve items from a database. The first one is uses the DataContext to call the stored procedure and in a LINQ syntax:


NorthwindDataContext db = new NorthwindDataContext();
var results = from item in db.CustOrderHist("category")
where item.Total > 10
select item;

and the second way is to use the extension with a lumbda expression:


results = db.CustOrderHist("category")
.where (item => Item.Total > 10);

I still havn’t figure out which one has which benefits comparing the other way.