How to convert datatable into generic type
How to convert DataTable having N rows into KeyValuePair<long,string>[]
type having same N no of rows
I want to return KeyVal开发者_JAVA技巧uePair<long,string>[]
kind of value from a function that will convert DataTable into above type.
return table.AsEnumerable()
.Select(r => new KeyValuePair<long, string>(r.Field<long>("longFieldName"), r.Field<string>("stringFieldName")))
.ToArray();
精彩评论