score:49
Accepted answer
linq solution:
myobjectlist = myobjectlist.where(x => idlist.contains(x.id)).tolist();
score:14
ienumerable<myobject> matches = myobjectlist.join(
idlist,
o => o.id,
id => id,
(o, id) => o);
Source: stackoverflow.com
Related Query
- Linq selecting items that exist in both list
- Linq for selecting elements from list 1 that exist on list 2 by comparsion between 2 properties values
- LINQ - Find all items in one list that aren't in another list
- LINQ return items in a List that matches any Names (string) in another list
- Remove items from list that intersect on property using Linq
- LINQ Lambda - Find all ID's in one list that don't exist in another list
- Linq - How to select items from a list that contains only items of another list?
- Linq return parent objects that have child items matching ALL items in separate list
- linq - how do you do a query for items in one query source that are not in another one?
- Apply a linq expression of an object to a list of items where that object is a propery of an item (Wrapper)
- C# LINQ selecting a list with a property that has multiple value
- Using LINQ I have a list of lists, how do I select all objects that exist in every list?
- Selecting "custom distinct" items from a List using LINQ
- Get items from input list that do not exist in the database using EF Core 2.1
- Excluding items from a list that exist in another list
- Linq to Entities - 'where' to bring back a list of Products and associated items checking both are enabled
- Linq items in a list exist in another list
- Speed Up Performance - LINQ to get items in one LIST, that are not in another List
- removing items from list that exist in another list based on an ID member
- Using LINQ to remove items from a list that do not apear in another list
- LINQ projection that pairs items and fills with null when nth item doesn't exist
- Get values from list that match BOTH attributes using c# LINQ
- Exluding Items that are in my Exceptions List LINQ to SQL
- Get List of Records that do not exist in another list - Linq
- Extracting a list of objects that exist in another list objects using linq
- How to select items that do not show up in a second list with Linq
- Using Linq Select to create a list that contains more items than the original list
- LINQ / C# Remove all items from a list that are in multiple other lists
- Remove both duplicate items (if one is duplicate) from a list using Linq
- Linq Grouping by a list of a list and selecting from both lists
More Query from same tag
- Using navigation to load entity 2 level deep
- LINQ to Entities - sorting on child collection with filter
- Linq from List<T> to DataGridView
- Select method missing from intellisense with Linq statement
- Linq to XML... null and missing elements
- ViewModel with a SelectList and a LINQ Query result with a single reocrd
- GroupBy with OR composite key not AND composite
- convert SQL query to LINQ / dot notation
- Cannot convert implicitly a type 'System.Linq.IQueryable' into 'Microsoft.EntityFrameworkCore.Query.IIncludableQueryable'
- Redirect method call within delegate
- How to group the headers and add where condition inside the select statement
- Why LINQ returns other column value than expected?
- Transforming list of periods into a list of dates in c#
- Getting the count of most repeated records in Linq
- Skip to the string and take other items
- Querying Related Dynamic Content Modules with Sitefinity
- Linq and RESTful services: how to best merge data from multiple tables in a resultset
- Find common items in list of lists of user type
- Counting parent objects using Linq
- "Time Clock" calculation in C#?
- Merging Dictionary containing a List in C#
- Query Dynamic Linq
- LINQ read Select values
- Simple LINQ Order by not working
- Simle/Nested foreach to linq( Concatenate string and Datatable rows and columns)
- Use SQL LIKE operator in C# LINQ
- Dynamically generate LINQ select with nested properties
- Paging in the stored procedure
- How can I save multiple Listbox value
- Need to combine two lambda expressions in one to execute two separate conditions of one parameter