I have been slowly moving the system I am working on from old legacy DataSets and DataTables to adding a bit of linq. Here is a quick and simple guide to using Linq with DataTables:
Firstly you need to make sure that the project is using Framework 3.5 and has the following references:
The next part is really easy. You would use linq as you normally would:
var variable = from datarow in dataSetVariable.Tables[0].AsEnumerable()
where (datarow.Field<int>(“Id”) == id)
select new
{
id = datarow.Field<int>(“Id”),
property = datarow.Field<int>(“property”)
};
then you can iterate through the list as you would normally:
foreach (var item in variable)
{
string property = item.property;
}
Hope this is usefull.