Loading ...

sort alphanumeric string using LINQ

Who is online?  0 guests and 1 members
home  »  forums   »  asp.net topics   »  getting started / general asp.net   » sort alphanumeric string using LINQ

sort alphanumeric string using LINQ

Posts under the topic: sort alphanumeric string using LINQ

Posted: 1/9/2012

Lurker 20  points  Lurker
  • Joined on: 11/12/2011
  • Posts: 4

Hi,

Does anyone know how to sort using linq-entity.


i use the following code:
from i in objEntities.Items
where ....
orderby i.Name
select i

The result is a1,a10,a11,a2,a3, b2,b21, b22,  c3....  But, i want it to be like a1,a2,a3,a10,a11, b2,b21,b22, c3...

This is very urgent. Please help me.


tags ASP.NET, LINQ

Posted: 1/10/2012

Professional 8338  points  Professional
  • Joined on: 4/15/2009
  • Posts: 424
  Answered

Posted: 1/14/2012

Lurker 20  points  Lurker
  • Joined on: 11/12/2011
  • Posts: 4

Thanks a lot

This was very very usefull!


Another similar article found here:

http://zootfroot.blogspot.com/2009/09/natural-sort-compare-with-linq-orderby.html?showComment=1258020708758#c5034722582649839449

Thanks again


tags LINQ, sort
Page 1 of 1 (3 items)