Using dotnet 2.0.
I currently have code like this :
DataView dv = new DataView(dsTrans.Transactions, filterSpec, sortSpec,
DataViewRowState.CurrentRows);
foreach (DataRowView dvr in dv)
{
DSTransactions.TransactionsRow transRow = (DSTransactions.TransactionsRow)dvr.Row;
// do something with transRow
}
where “dsTrans” is a strongly typed DataSet. I’m wondering if there is a more type-safe way to iterate over the rows of the DataView, which does not involve using a cast (or using the “as” keyword).
(Note that some ordering and filtering is needed, which is why a DataView is used)
Thanks.
You could try this: