I just provide a simple explanation of how expressions work. From the sample code in the example below, here is an example -
System.Linq.Expressions.Expression<Func<int, bool>> expr = i => i < 5;
So, in simple words, we say that you have a function that returns true if no <5 like -
Func<int, bool> deleg = i => i < 5;
So you can create an expression using the same thing using the syntax above and then pass it in to say a Where or some simlyar thing. A simple example is
int[] i={1,2,3,4,5} System.Linq.Expressions.Expression<Func<int, bool>> expr = i => i < 5; var result=i.Where(expr);
In your case, you have a table as a parameter, so it will take a table object and return bool.
List<Employee> e= new List<Employee>(); e.Add(new Employee(1,"ABC",5000)); e.Add(new Employee(2,"ACC",5000)); e.Add(new Employee(3,"ADC",50009)); System.Linq.Expressions.Expression<Func<Employee, bool>> expr =e => e.Salary < 50000; var result=e.Where(expr);
source share