我有这本字典:
KEY VALUE
08/10/2013, 00:00:00, a, b, c, d, e, f, g, h, i
08/10/2013, 00:01:00, a, b, c, d, e, f, g, h, i
08/10/2013, 00:02:00, a, b, c, d, e, f, g, h, i
08/10/2013, 00:03:00, a, b, c, d, e, f, g, h, i
08/10/2013, 00:04:00, a, b, c, d, e, f, g, h, i
08/10/2013, 00:05:00, a, b, c, d, e, f, g, h, i
08/10/2013, 00:06:00, a, b, c, d, e, f, g, h, i
其中日期和时间是我的关键,而 'a, b, c, d, e, f, g, h, i' 是我的值。
我想把上面的字典放在一个DataTable
.
我该怎么做?使用两个foreach
循环?
private static void DictonaryTodataTable (DataTable dtResult, Dictionary <DateTime, CommaSeparatedList> CSVData)
{
foreach (KeyValuePair item in <DateTime, CommaSeparatedList> CSVData)
{
DtResult.NewRow DataRow dr = ();
[ CODE ]
dtResult.Rows.Add (dr);
}
}