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 Query
- 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
More Query from same tag
- Use LINQ to omit some entries in the value part of a dictionary and project this into a new dictonary maintaing original keys
- how to parse xml , linq c#
- Linq sum in Controller and pass to View ASP NET CORE 2.1
- Multiple on clause in LINQ to DataTable Join Query
- Select fails to print to console
- How can I get the max SortOrder as an int?
- Linq query with multiple joins and groups
- LINQ Select First
- Formatting api JSON response to add attributes to an array
- conditional where in linq query
- CRM 2011: An unhandled exception of type 'System.InvalidOperationException' occurred. referenced from scope '', but it is not defined
- replace a word from string in list C# LINQ
- retrieve data to textboxt using LINQ to SQL
- Can't build lambda Expression with unknown type of a property
- Linq Dynamic query and include non related entity
- LINQ -Single operator
- How to display two tables separately in a single view with a join query in one table?
- transpose 2D array that exists as IEnumerable of IEnumerable
- Showing First Instance and Last Instance of GroupBy ASP.NET MVC
- selectlist distinct upper mix in query
- How to loop collections in LINQ and pass on data
- Nested Anonymous Type in LINQ
- Stored Procedure not being recognized in LINQ to SQL as a ISingleResult
- Reduce repetition in similar queries
- Difference between two array of objects in C#
- LINQ Custom OrderLine Fields in uCommerce
- parsing a dynamic collection
- Can LINQ create a backup table/duplicate temporary table?
- Check if a string is sorted
- Perform manipulation on all elements except last element in a List using Linq