How do you convert a DataTable into a generic list?

Posted by IainMH on Stack Overflow See other posts from Stack Overflow or by IainMH
Published on 2008-10-16T13:23:50Z Indexed on 2010/03/15 13:19 UTC
Read the original article Hit count: 411

Filed under:
|
|

Currently, I'm using:

DataTable dt = CreateDataTableInSomeWay();

List<DataRow> list = new List<DataRow>(); 
foreach (DataRow dr in dt.Rows)
{
    list.Add(dr);
}

Is there a better/magic way?

© Stack Overflow or respective owner

Related posts about c#

Related posts about datatable