I would like to convert this DataTable
dt.Columns.Add(new DataColumn("timespan1", typeof(TimeSpan)));
dt.Columns.Add(new DataColumn("timespan2", typeof(TimeSpan)));
into this
dt.Columns.Add(new DataColumn("timespan1", typeof(double)));
dt.Columns.Add(new DataColumn("timespan2", typeof(double)));
I've managed to do it this way.
Double d;
foreach (DataRow row in dt.Rows)
{
dr = dtNew.NewRow();
dr[0] = row.ItemArray[0];
Double.TryParse(((TimeSpan)(row.ItemArray[1])).TotalMinutes.ToString(), out d);
dr[1] = d;
Double.TryParse(((TimeSpan)(row.ItemArray[2])).TotalMinutes.ToString(), out d);
dr[2] = d;
dtNew.Rows.InsertAt(dr, 0);
}
Is there any way to use Linq or a lambda expression? I would like to bind this new <double> DataTable
to a stacked bar chart. Appreciate your help. Thanks.