用到的总结一下啦:
按列表的某个字段来排序:
void _createUiCustomerSelectionPanel(Dictionary<string, _tStoryInfoDb> map_story_info)
{
map_story_info= map_story_info.OrderBy(_tStoryInfo => _tStoryInfo.order_id).ToList<_tStoryInfo>();
}
按字段降序:
mReadQueue = mReadQueue.OrderByDescending(_tNodeInfo => Convert.ToDateTime(_tNodeInfo.notice_read_time)).ToList<NoticeInfo>();
按降序:
list_score_rank.Sort((rank1, rank2) =>
{
if (rank1.rank > rank2.rank)
{
return 1;
}
else if (rank1.rank < rank2.rank)
{
return -1;
}
else
{
return 0;
}
});
按升序:
list_score_rank.Sort((rank1, rank2) =>
{
if (rank1.rank > rank2.rank)
{
return -1;
}
else if (rank1.rank < rank2.rank)
{
return 1;
}
else
{
return 0;
}
});