How to convert DataTable having N rows into KeyValuePair<long,string>[]
type having same N no of rows
I want to return KeyValuePair<long,string>[]
kind of value from a function that will convert DataTable into above type.
How to convert DataTable having N rows into KeyValuePair<long,string>[]
type having same N no of rows
I want to return KeyValuePair<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();