使用此代码:
Dictionary<DateTime, double> FlowInformation = new Dictionary<DateTime, double>();
foreach (DateTime key in FlowInformation)
{
if (initialialrec != 0)
{
if (FlowInformation[key] > initialialrec)
flow = key.ToShortDateString() + " " + key.ToShortTimeString() + "+";
if (FlowInformation[key] < initialialrec)
flow = key.ToShortDateString() + " " + key.ToShortTimeString()+"-";
initialialrec = FlowInformation[key];
file.WriteLine(flow);
}
FlowInformation.Clear();
}
我得到一个编译错误:
Strategy\theFlowStrategy.cs 无法将类型“System.Collections.Generic.KeyValuePair”转换为“System.DateTime”
我如何迭代这个集合?