score:2
Accepted answer
Assuming that myList
is a List<string>
, you can try something like this:
var query = from r in d.AsEnumerable()
where myList.Any(r.Field<string>("Column7").Contains)
select r;
Or, if myList
is a List<int>
, you might want to modify your Database column to also have type int
, and you can do the following:
var query = from r in d.AsEnumerable()
where myList.Contains(r.Field<int>("Column7"))
select r;
Source: stackoverflow.com
Related Articles
- How can i change this LINQ query to use my List<int> instead of the hard coded number?
- developing LINQ query where column values can be hard coded but row headings are dynamic
- How do I change this sql query to linq to sql?
- How I change this code to be in linq style
- Reduce the line of code for this LINQ query
- How to code this LINQ query in a better way
- Why does this linq query fail when I change the select clause to select new Model
- MVC 5 - Why is my linq code selecting an entire query instead of a single value?
- How to convert this LINQ to Entities query into 'Method Syntax' instead of 'Query Syntax'
- how do I change this sql query [Select MAX(id)] to linq
- How do you construct a LINQ to Entities query to load child objects directly, instead of calling a Reference property or Load()
- Why does adding an unnecessary ToList() drastically speed this LINQ query up?
- LINQ query to perform a projection, skipping or wrapping exceptions where source throws on IEnumerable.GetNext()
- AsNoTracking using LINQ Query syntax instead of Method syntax
- why is this linq query return a boolean and not the first result of the select?
- Enumerable.Empty<T>().AsQueryable(); This method supports the LINQ to Entities infrastructure and is not intended to be used directly from your code
- Why is this LINQ query not executed when using foreach?
- Does this LINQ code perform multiple lookups on the original data?
- How can I convert this SQL Query into LINQ (OVER (PARTITION BY Date))
- Shorten this LINQ query via the help of an anonymous type?
- Is there any way to create a LINQ query as a variable without having the data source (yet)?
- Why does this LINQ grouping have a count of 3 instead of 2?
- Does this linq query run on every iteration of the for-each loop?
- How to write this Linq SQL as a Dynamic Query (using strings)?
- Cache a Linq Query - is this possible?
- LINQ Source Code Available
- Why does this LINQ query compile?
- How does this linq code that splits a sequence work?
- multiple orderby in this linq code
- What does this LINQ query do?
- EF linq/lambdas join 2 tables with concat
- LINQ multiple join IQueryable modify result selector expression
- Subtotals, not groups, using LINQ?
- sum for nullable field in linq
- Combine multiple LINQ expressions from an array
- How to Group a List of Objects by a Running Total?
- Best practice recursive flattening of linked list in c#
- Linq Contains to return ALL items or selected ones?
- Filter all the record having navigation property in Linq .Net MVC
- Linq - Using a query as function in a select
- A better way than generic list of anonymous type
- c# Fetch nodes elements from xml
- Linq query for NOT IN on joined table
- Perform Inner Join on 2 Files of type IEnumerable<XElement>
- How to compare two lists and find the mismatch them in c#?
- Unable to search with FirstOrDefault Method
- Can we filter Datatable with LINQ?
- Do conditional Where filters use deferred execution?
- Facebook Interview Question: Formatting a collection of times for a movie show time output (using Linq is preferred)
- Linq or SQL join tables on different servers