score:0
foreach (string q in query)
{
results = results.where(u => u.name.contains(r) || u.text.contains(r));
}
score:1
results = results.where(u => u.name.contains(r)).union(results.where(u => u.text.contains(r)));
Source: stackoverflow.com
Related Query
- How to dynamically add Where and Or statements to a Linq query
- How to add where statements dynamically by linq
- How to dynamically add OR operator to WHERE clause in LINQ
- How to add left outer join to grouped and summed LINQ query
- How linq to nhibernate by join and Separate where in query
- LINQ Query with Array input and variable Where Statements - Advice
- How to utilize EF and LINQ to add filters and specify tables, columns, filters and order by dynamically
- How to dynamically add or remove where clause in LINQ
- LinQ query - Add Where dynamically
- How to dynamically query the database using LINQ and a variable?
- How can I do a LINQ query joining two entities and select what a Where on one of the entities?
- How can I dynamically build a linq OR query where one of several columns can match the search string?
- How to LINQ query with variable where and select?
- Linq - How to take the result for a query in Linq and add it to an Array
- How can I send where statements to a method which are dynamically executed in a LINQ statement?
- How to query a Datatable using LINQ and add values to a List?
- How to AND predicates in the WHERE clause in a LINQ to RavenDB query
- linq query dynamically add where condition?
- How to dynamically group a list and select values using linq query in C#?
- How can I add Where expressions to a LINQ query if I'm not sure which properties I'll want to match?
- How to write OrderByDescending and where clause in single LinQ query
- How to query and calculate dates in the where clause of a LINQ statement?
- How can I get a complex LINQ query to work where I need to check by two elements and an attribute?
- How can i make a LinQ query using where and with an int[] list?
- How to Add a Where Not Equals condition in Linq query
- How to execute a linq query for each item in a list , use it in the where clause and return a collection from the result of each query?
- can't figure out how to add where clause to this LINQ query
- How do I add a where clause to a field that is not part of the return set for LINQ query
- how to add to linq query expression if a condition is met dynamically
- LINQ to Datatable - How to add an if condition in linq query where clause?
More Query from same tag
- LINQ to DataTable Easy and Fast
- Use LINQ to compare the date part of DateTime
- The method 'Where' cannot follow the method 'Select' or is not supported
- Convert the result of LINQ query to list of Custom Model
- How to extract every occurence of tags in an XML file
- C#: async in LINQ
- Querying an Xml Document for elements using Linq
- Using Ardalis.Specification to query CosmosDb using Linq syntax
- Group by Linq vs Transact Sql
- The translation of String.IndexOf to SQL does not support versions with a StringComparison argument
- Printing out the results of my linq query
- LINQ to JSON selection of certain elements
- Convert Entity data model to Data Transfer Object
- C# LINQ - How to build Group By clause dynamically
- I need to get multiple index's instead of one using linq
- Compare two collections and add/remove from one to make them match
- WPF combobox binding using linq
- Linq security - hide columns
- Linq to SQL to aggregate data by week
- Convert string time to datetime or timespan in entity framework query
- Linq, OData and WCF : “the method join is not supported”
- PredicateBuilder returning zero records
- Use linq in the where clause
- EF Core updating foreign key is not updating the navigation property
- How to take last records from list
- LINQ unexpected behavior when returning IEnumerable and calling ToArray
- Best way to find inner node values using linq
- Permutations of arrays within an array
- Using Generic with Func as a parameter
- Retrieve a list of specific elements from an XDocument using LINQ