score:37
Accepted answer
var results = dataset.where(i => !excluded.any(e => i.contains(e)));
score:-1
var result = dataset.where(x => !excluded.contains(x));
score:0
var result=dataset.where(x=>!excluded.exists(y=>x.contains(y)));
this also works when excluded list is empty.
score:7
try:
var result = from s in dataset
from e in excluded
where !s.contains(e)
select e;
score:14
// contains four values.
int[] values1 = { 1, 2, 3, 4 };
// contains three values (1 and 2 also found in values1).
int[] values2 = { 1, 2, 5 };
// remove all values2 from values1.
var result = values1.except(values2);
Source: stackoverflow.com
Related Query
- Exclude list items that contain values from another list
- Linq - How to select items from a list that contains only items of another list?
- How can I set properties on all items from a linq query with values from another object that is also pulled from a query?
- Using Linq, get all items from list that are in another List<int>
- Select items from a List where the children contain the items from another List using LINQ
- How to use LINQ to query list of strings that do not contain substring entries from another list
- Excluding items from a list that exist in another list
- Select all from one List, replace values that exist on another List
- removing items from list that exist in another list based on an ID member
- Get a list of files that don't contain something from another list
- Remove items from one list if they contain strings from another list
- Using LINQ to remove items from a list that do not apear in another list
- Remove items from a List that are in another List by specific property with grouping
- Cannot exclude from a list items contained in another list with Linq
- Get the items from a list that match all itens from another list
- Linq - get objects with a list property that does not contain values in another list
- LINQ Query - exclude the values of one list from another list
- LINQ: Select where object does not contain items from list
- LINQ - Find all items in one list that aren't in another list
- Remove items of list from another lists with criteria
- Find items from a list which exist in another list
- LINQ return items in a List that matches any Names (string) in another list
- How do I move items from a list to another list in C#?
- Remove items from list that intersect on property using Linq
- Exclude items of one list in another with different object data types, LINQ?
- Assign values from one list to another using LINQ
- Check if one list contains all items from another list in order
- C# Sorting a List based on the sequence of values from another List (different classes)
- How to generate a unique list of items from another list using LINQ in C#
- Adding only new items from one list to another
More Query from same tag
- Count how many times a number appeared within a range of that list
- How do I combine IQueryables into a single call?
- How to read from an XML and display in a textbox and label in a Winform
- EntityFramework - Group by unordered pair in LINQ query
- MongoDB C# driver fast on take(1) but slow on take(2)
- How to use LINQ select in one column with condition
- trying to do a linq query return on a sub query
- Parse csv or excel file in Silverlight
- Change what is returned by the SingleOrDefault method
- MongoDB Linq driver casting exception
- Linq Func delegate - can it be added to?
- Extension Method To Take A Dynamically Built Search Expression?
- CRM 2011 LINQ: Invalid ‘where’ condition. An entity member is invoking an invalid property or method
- Building a dynamic anonymous type Select statement using Linq
- Select hierarchical data via Linq2SQL
- Make List of Integers to Objects
- An Entity Framework expression to find entities that don't match some property
- how to combine two linq query into one in c#
- Return a list of posts where Blog.ID == id in c#
- Nested Linq Min() crashes Visual Studio
- Chunk list of strings by common prefix
- Scraping XML from a website with VB.NET and LINQ
- C# Silverlight WCF Linq Service Select from MSQL Database
- Find the highest small number in List <int>
- LINQ (to objects) , running several queries over the same IEnumerable?
- What is the difference between using Join in Linq and "Olde Style" pre ANSI join syntax?
- How can I iterate over a C# IEnumerable in Matlab?
- C# search query with linq
- How to select certain strings (by index) from a list in a list with linq?
- C# LINQ Projecting to a class