I am generating a result
using the following LINQ query:
var field = "FirstName"; // or "LastName"
var type = "asc"; // or "desc"
var result = (from x in db.ContactSet
select new
{
x.FirstName,
x.LastName
}).ToList();
I need to orderby
asc
or desc
(based off the type
variable) for the field
variable.
How can I do this in a clean way?
EDIT: The question referred to by the duplicate does not answer this.