开发者

Sorting OrderedEnumerableRowCollection .. strings like 00-000, 01-000 are not sorted as expected

开发者 https://www.devze.com 2023-03-20 04:42 出处:网络
i\'ve got some records from a query like this SortingCode (column) Row: 00-005 Row: 00-000 the folowing code, doesn\'t sort this 开发者_如何学C...

i've got some records from a query like this

SortingCode (column) Row: 00-005 Row: 00-000

the folowing code, doesn't sort this 开发者_如何学C...

var items = 
    from c in table
    orderby c.SortingCode
    select c;


You will have to explain what result you are expecting, because the following code

var items = new List<string>() { "00-005", "01-004", "00-003" };

foreach (var item in items.OrderBy(i => i))
{
    Console.WriteLine(item);
}

Do output

00-003
00-005
01-004

Which seem well sorted for me. What result are you expecting?

0

精彩评论

暂无评论...
验证码 换一张
取 消