How to efficiently convert DataSet.Tables to List<DataTable>?

Posted by Soenhay on Stack Overflow See other posts from Stack Overflow or by Soenhay
Published on 2013-10-21T21:50:52Z Indexed on 2013/10/21 21:53 UTC
Read the original article Hit count: 165

Filed under:
|
|
|

I see many posts about converting the table(s) in a DataSet to a list of DataRows or other row data but I was unable to find anything about this question. This is what I came up with using in .Net 3.0:

    internal static List<DataTable> DataSetToList(DataSet ds)
    {
        List<DataTable> result = new List<DataTable>();

        foreach (DataTable dtbl in ds.Tables)
        {
            result.Add(dtbl);
        }

        return result;
    }

Is there a better way, excluding an extension method?

Thanks

© Stack Overflow or respective owner

Related posts about list

Related posts about datatable