I search a way to convert a dataTable to List(of T).
In Vb.net on .Net 3.5
If you know How To or maybe a link of somebody who did it.
tank you
I check this on c# (from another stack question)
public static IEnumerable<T> ToEnumerable<T>(DataTable dt, Func<DataRow, T> translator)
{
foreach(DataRow dr in dt.Rows)
{
yield return translator(dr);
}
}
but I cant translate Func on .net 3.5 (I didnt found how to do it. or the good lib)
You need to add the reference to the following assembly:
C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll
otherwise you can´t call the AsEnumerable() method.
Tim Schmelter wrote an additional tip:
You need to add a reference to System.Data.DataSetExtensions.dll. In VB.NET you don't need to call it explicitely(Dim rows = (From row in dt).ToList).