Which will crash if the
datatype
of the column is not a
string
.
You might also want to note that this only works for typed
dataset
s.
This version works for all
dataset
s, can handle any
datatype
, and handles
null
values:
table.Rows.AsQueryable<datarow>()
.Select(row => (row["fieldname"] ?? "").ToString())
.ToArray();