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();
Doing that 'computer thing' ever since the C64.
Sometimes I feel that being a programmer is much like being a doctor: You just have to know everything and if you don't, something dies.
Either being an application or a patient.
Oddly enough, more people care about the death of their application, than the massacre of people...