How can I sort a List<Issue> by date
This question already has an answer here:
Sorting date saved as string will only work when your date format is year.month.day
. If you can't (or do not want) use DateTime
variable to store date you will have to write your own comparer for 'Issue' or override Equals
method. I'd advice to use proper type for DateTime
instead of string.
One of the way is using linq, assuming your StartDate property is of type string
.
var sortedList = usersissueslist.OrderBy(item => item.StartDate).ToList();
As suggested by everyone.
链接地址: http://www.djcxy.com/p/70960.html上一篇: 如何从两个位置的经度和纬度找到距离?
下一篇: 我怎样才能按日期排序列表<问题>