我有一个填充和排序的动态列表:
List<dynamic> eventList = new List<object>();
foreach (Task t in tasks)
{
eventList.Add(
new
{
id = "t" + t.TaskID.ToString(),
title = t.TaskTitle,
start = ResolveStartDate(StartDate(t.Schedule.DateFrom.Value)),
end = ResolveEndDate(StartDate(t.Schedule.DateFrom.Value), t.Schedule.Hours.Value),
description = t.TaskDescription,
allDay = false,
resource = t.Schedule.EmployeID.ToString(),
color = ColorConversion.HexConverter(System.Drawing.Color.FromArgb(t.Project.Color.Value))
}
);
}
foreach (Case c in cases)
{
eventList.Add(
new
{
id = "c" + c.CaseID.ToString(),
title = c.CaseTitle + "-" + c.Customer.CustomerDescription,
start = ResolveStartDate(StartDate(c.Schedule.DateFrom.Value)),
end = ResolveEndDate(StartDate(c.Schedule.DateFrom.Value), c.Schedule.Hours.Value),
description = c.CaseDescription,
allDay = false,
resource = c.Schedule.EmployeID.ToString(),
color = ColorConversion.HexConverter(System.Drawing.Color.FromArgb(c.Color.Value))
}
);
}
eventList.OrderBy(p => p.title);
当我在排序调用之前和之后检查调试模式时,列表根本没有排序,它是按添加的顺序排列的。
当我运行它时,我也没有看到任何排序。有什么问题?