Dynamic Linq: Construct linq queries on fly in C#
Linq is a great feature of .net framework which makes the queries more readable and simplifies the queries. Sometimes we may need to construct the queries dynamically. Dynamic linq supports to construct queries on fly. This is mainly helpful when you want to construct logic from UI or pass queries from XML or any configuration file. The below is the test data used throughout this article. Download Dynamic linq code Test Data: List<Employee> employees = new List<Employee>(); Employee employee1 = new Employee {Name = "Sampath" , Age = 25, Salary = 5000M, Id = 1}; Employee employee2 = new Employee { Name = "Kumar" , Age = 27, Salary = 10000M, Id = 2 }; Employee employee3 = new Employee {...