You need to create a LINQ query dynamically

  • To Order By
  • To Select
  • To Filter/Where


There is two common solutions:

Example – Eval-Expression.NET

// using Z.Expressions; // Don't forget to include this.

var list = new List() { 1, 2, 3, 4, 5 };

var list2 = list.Where(x => "x > 2");
var list3 = list.Where(x => "x > y", new { y = 2 });


Features Eval-Expression.NET Dynamic LINQ
OrderBy `.OrderByDynamic(“x => x.P1”)` `.OrderBy(“P1”)`
Select `.SelectDynamic(“x => new {Y = x.P1, x.P2}”)` `.Select(new(P1 as Y, P2)`
Where `.Where(“x => x.P1 == 1 && x.P2 == 2”)` `.Where(“P1 = 1 and P2 = 2”)`

The main difference between both library is Eval-Expression.NET use the same syntax as LINQ while LINQ Dynamic Query Library uses it own syntax.



Eval-Expression.NET library go way beyond in features. Everything you can do with LINQ, you can do it with this library by building the expression dynamically.

###### PRO

  • Easy to use
  • Use LINQ Syntax

###### CON

  • Some method renamed with “Dynamic” suffix

LINQ Dynamic Query Library

This library is great! It is very easy to setup and getting started and support almost all scenarios you may encounter.

###### PRO

  • Easy to use

###### CON

  • Do not use LINQ Syntax
  • Less flexible than Eval-Expression.NET

You can read an excellent introduction from Scott Guthrie Blog: Dynamic LINQ


Both libraries are a very good choice. Most people will tend to use LINQ Dynamic Query Library since it has been around for a way more time than Eval-Expression.NET even if less flexible.