foreach (var row in table.Rows)
{
DoSomethingWith(row);
}
Assuming that I\'m working with a standard System.Data.DataTable
(which has
table.Rows
is a DataRowCollection which is IEnumberable
( and not IEnumerable
, T being DataRow
), so it is not strongly typed to a DataRow
, but a object i.e it is a collection of objects.
There is a DataTable
extensions which you can use though - http://msdn.microsoft.com/en-us/library/system.data.datatableextensions.asenumerable.aspx
foreach (var row in table.AsEnumerable())
{
}