I am trying to make a LINQ statement where the where clause comes from a variable. For example:
string whereClause = address.zip == 23456;
var x = from somet
This:
var query = from something in someList where whereClause;
is shorthand for:
var query = someList.Where(something => whereClause);
Assuming someList is an IEnumerable, Where refers to the Enumerable.Where Extension Method. This method expects a Func which you can define as follows:
Func whereClause = address => address.Zip == 23456;
var query = someList.Where(whereClause);