0

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 ...

var items = 
    from c in table
    orderby c.SortingCode
    select c;
Steven
  • 166,672
  • 24
  • 332
  • 435
Ruutert
  • 395
  • 1
  • 7
  • 18

1 Answers1

2

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?

Pierre-Alain Vigeant
  • 22,635
  • 8
  • 65
  • 101
  • Sorry, I use multiple columns that needs to be sorted ... I've fixed it by doing this: var items = (from c in table select c).OrderBy(row => row.SortingCode).ThenBy(row => row.Description).ThenBy ....; This works fine for me Thx for your reactions and quick support – Ruutert Jul 13 '11 at 14:01