score:3
Accepted answer
Something like the following:
var inner = PredicateBuilder.False<Product>();
inner = inner.Or (p => p.Description.Contains ("foo"));
inner = inner.Or (p => p.Description.Contains ("far"));
var outer = PredicateBuilder.True<Product>();
outer = outer.And (p => p.Price > 100);
outer = outer.And (p => p.Price < 1000);
outer = outer.And (inner);
var results = data.Products.AsExpandable().Where(outer)
You can read more about PredicateBuilder here
Source: stackoverflow.com
Related Articles
- Linq PredicateBuilder multi criteria
- LINQ Source Code Available
- creating Linq to sqlite dbml from DbLinq source code
- How to flatten a multi level XML into a single level XML using c# code LINQ
- source code for LINQ 101 samples
- Using LINQ to Filter Multi Dimensional Criteria
- c# Linq or code to extract groups from a single list of source data
- Why this multi linq join code does not work?
- Convert string[] to int[] in one line of code using LINQ
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- Linq code to select one item
- LINQ to SQL Where Clause Optional Criteria
- How are people unit testing code that uses Linq to SQL
- LINQ query to perform a projection, skipping or wrapping exceptions where source throws on IEnumerable.GetNext()
- Linq PredicateBuilder - Multiple ORs
- Syntax to execute code block inside Linq query?
- Enumerable.Empty<T>().AsQueryable(); This method supports the LINQ to Entities infrastructure and is not intended to be used directly from your code
- Best open source LINQ provider
- LINQ to SQL - How to efficiently do either an AND or an OR search for multiple criteria
- Is there a good source that gives an overview of linq optimizations?
- Does this LINQ code perform multiple lookups on the original data?
- How to understand the following C# linq code of implementing the algorithm to return all combinations of k elements from n
- LINQ WHERE method alters source collection
- LINQ query to split an ordered list into sublists of contiguous points by some criteria
- Where can I view LINQ source code?
- Suggestions for designing complex LINQ code
- Is there any way to create a LINQ query as a variable without having the data source (yet)?
- Unwieldy LINQ statement with multiple search criteria
- Dynamic linq query with multiple/unknown criteria
- Left outer join using LINQ -- understanding the code
- Dynamically select LINQ SELECT fields at runtime
- LINQ - How to Group By with Dictionary <string, string[]>?
- linq and string array
- Get the max date from a list of value inside a dictionary
- Getting an type conversion error while using linq in entity framework
- Why don't the values from my linq queries appear immediately?
- What is the way to join these two list?
- Interesting behavior : LINQ query with integer
- Linq Select unique items from groups and get similar item by ID
- Remove non unique objects between two lists C#
- EF query using extension method inside extension method
- How to do radial collections querying in C#?
- How to write fast subquery in where condition in linq
- Sorting XML file by attribute value alphabetical
- How to query database using LINQ to bring data from database based on array of months in ASP.Net MVC 5?
- LINQ OrderBy based on row values
- Object reference not set to an instance of an object list to a list using linq
- How to create a delegate from Expression<Func< , >>? (pass a parameter to the expression)?
- DbSet LINQ query to inner collection does not throw an Argumentexception
- LINQ CustomDataRowEqualityComparer