Orderby() not ordering numbers correctly c#

后端 未结 12 1716
渐次进展
渐次进展 2020-12-15 03:08

I am writing an app for my company and am currently working on the search functionality. When a user searches for an item, I want to display the highest version (which is st

12条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-15 03:24

    It sounds like you have a text value instead of a numeric value.

    If you need to sort, you can try:

    var items = (from r in results
                 select r);
    return items.OrderBy( v=> Int.Parse(v.Version) );
    

提交回复
热议问题