score:93
Accepted answer
are you trying to get a list of objectbs where all of the objectas are in listofidsa, or any of them?
i think you want either:
listobjectb.where(p => p.listofobjecta.any(x => listofidsa.contains(x.id)))
or
listobjectb.where(p => p.listofobjecta.all(x => listofidsa.contains(x.id)))
(you may well want to make listofidsa
a hashset<string>
if it's of significant size, btw.)
Source: stackoverflow.com
Related Query
- Linq query list contains a list
- Dynamic Linq query Contains List
- Linq to entities - SQL Query - Where list contains object with 2 properties (or more)
- LINQ query returns old results when source list is re-initialized
- What kind of query in LINQ do I have to make to get a custom List that contains Lists of objects?
- Linq query list contains a list with same order
- Linq query to find a match where nested list contains sequence
- Linq Contains Query from Table List
- trying to write a LINQ query using contains and starts with from a List
- Problem with a Linq to Entity query that contains a passed list of entities
- LINQ query to create a list of objects where each object contains a list
- linq query where contains list of class
- c# Linq or code to extract groups from a single list of source data
- Dynamic linq query that Contains ALL from another list
- How to query with Linq a List that contains a list of lists that contains a list of lists that contains a list of objects?
- Convert For-Each into a LINQ query for adding items in list and check wehter list contains the item already
- linq where list contains any in list
- LINQ query to return distinct field values from list of objects
- LINQ query to find if items in a list are contained in another list
- Check if a string within a list contains a specific string with Linq
- LINQ To SQL exception: Local sequence cannot be used in LINQ to SQL implementation of query operators except the Contains operator
- How to use Linq to check if a list of strings contains any string in a list
- Linq query between two list objects
- LINQ query to perform a projection, skipping or wrapping exceptions where source throws on IEnumerable.GetNext()
- Linq Query Dictionary where value in List
- Linq - How to select items from a list that contains only items of another list?
- Query a List of List of Items in LINQ c#
- Linq query to filter id inside a list of list c#
- list contains an ID in linq
- Checking if list of Tuple contains a tuple where Item1 = x using Linq
More Query from same tag
- LINQ query code for complex merging of data
- Linq and parameters
- LINQ - "Index was outside the bounds of the array."
- Get xml node properties via c#
- LINQ strong typing
- Cannot implicitly convert type 'System.Collections.Generic.List< >' to 'System.Collections.Generic.IList< >'
- How to group a period of time into yearly periods ? (split timespan into yearly periods)
- Convert Anonymous Type to List <T> using Linq to SQL in C#
- C# mongodb driver throwing System.InvalidOperationException on linq query with OrderByDescending
- Optimizing a LINQ query
- Data Conflict in LINQ
- XML to LINQ with Checking Null Elements
- Output string variable in left hand side of assignment using LINQ
- Using Linq, how would one join two tables without a foreign key relationship between the two tables?
- Making expressions from lambda functions that are not for comparison
- Get records from Generic Object using LINQ C#
- LINQ XML - add element go in Null Exception
- Efficient Way to Select Max 5 Numbers from Sorted Arrays
- LINQ to SQL Associations Not Generating
- GridView DynamicField child property generates "table does not have column" error
- Linq query null check in data source
- Dynamically Entering "select" by a string in LINQ Query
- Filter data from a virtual foreign key on an SQL query
- How to order by 2 fields with relation child/parent. Sort it so that child items follow their parents in the sorted list?
- C# Linq Subset Data
- SqlException (0x80131904): Line 28: Incorrect syntax near '('.]
- How to write GroupJoin Lambda Expression in Linq query?
- C#: Add conditional generic method (different generic restriction) within generic class
- Check if single element is in a list in LINQ when the single is provided first
- Select a row in a DataTable and change the header name to a new name and order by first and last names