我有一个SortedDictionary,键是一个int值,每个键的匹配值是一个类对象。该类包含一个int和一个两个datetime变量。基于值排序SortedDictionary,而不是键
我需要根据我的类中的InTime日期时间对我的SortedDictionary进行排序。所以当我做一个foreach循环访问SortedDictionary时,我会根据datetime对它们进行排序。
这可能吗?我怎样才能实现它?
enter code here
class Busdetail
{
public int BusNo { get; set; }
public DateTime InTime { get; set; }
public DateTime OutTime { get; set; }
}
可能的重复http://stackoverflow.com/questions/289/how-do-you-sort-ac-dictionary-by-value – WildCrustacean 2010-08-05 17:20:48
可能重复的[.NET SortedDictionary,但按值排序](http:/ /stackoverflow.com/questions/2619051/net-sorteddictionary-but-sorted-by-values) – nawfal 2014-05-22 05:28:46