我正在写C#排序列表框与多个字段按日期
我有两个列表框。
列表框1被填充,我没有问题。
然后,我有一个foreach循环遍历列表框1中的每个项目,并基于linq查询填充列表框2。
foreach (var item in listBox2.Items)
{
var date =
(from z in task.tblContractProcessRequests
where z.RequestID == Int32.Parse(item.ToString()) && z.RequestTypeID == 1
select z).Single();
listBox3.Items.Add(date.RequestID + " - " + date.RequestTime);
}
所以现在我的列表框2看起来是这样的
12345 - 01/12/2010
65432 - 03/12/2009
92354 - 12/31/2013
我怎么会那么解决这第二个列表框中海湾日期下降到这个样子?
92354 - 12/31/2013
12345 - 01/12/2010
65432 - 03/12/2009
您可以在日期存储在一个排序的字典,然后检索值使用keyvaluepair保存,并把它们添加到列表框中 – deathismyfriend 2014-10-02 20:36:20