我有一个SortedDictionary,键是一个int值,每个键的匹配值是一个类对象.该类包含一个int和一个两个datetime变量.
我需要根据我班级的InTime日期时间对SortedDictionary进行排序.因此,当我做一个foreach循环我的SortedDictionary时,我会根据日期时间对它们进行排序.
这可能吗?我怎样才能实现它?
enter code here
class Busdetail
{
public int BusNo { get; set; }
public DateTime InTime { get; set; }
public DateTime OutTime { get; set; }
}
Run Code Online (Sandbox Code Playgroud) c# ×1