c# - How to convert DataRow[] to List<string[]> -
i have
datatable dt; datarow[] drarray = dt.select().toarray();
my requirement want convert drarray
list<string[]>
or converting datatable list<string[]>
in fastest way.
i think want:
list<string[]> results = dt.select() .select(dr => dr.itemarray .select(x => x.tostring()) .toarray()) .tolist();
this works if items stored in dr.itemarray
have overriden .tostring()
in meaningful way. luckily primitive types do.
Comments
Post a Comment