LINQ: orderby with dynamic string parameter

Posted by Luca Romagnoli on Stack Overflow See other posts from Stack Overflow or by Luca Romagnoli
Published on 2010-04-28T09:47:37Z Indexed on 2010/04/28 9:53 UTC
Read the original article Hit count: 360

Filed under:
|
|

HI, i want to do this:

orderby = "Nome, Cognome desc";
var timb = time.Timbratures.Include("Anagrafica_Dipendente").Where(p => p.CodDipendente == 1);
            if(orderBy != "")
             timb = timb.OrderBy(orderBy);

Is there any method for pass a string parameter to Orderby

thanks

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about ASP.NET