score:0
string productname = "sugar";
// keep only the orders that have at least one product with name "sugar"
var orderswithsugar = queryorderswiththeirproducts
.where(order => order.products.where(product => product.name == productname)
.any());
Source: stackoverflow.com
Related Query
- Exception when changing data source to SQL
- SQL Exception violation of primary key constraint when updating data
- LINQ to SQL does not update when data has changed in database
- LINQ to SQL - Compile error when extending data context with partial class and methods
- CreateDocumentQuery throws exception when used with LINQ, fine with SQL
- I got a null reference exception on a Linq To SQL data context and I don't even really know where to start
- Foreign Key Reference Already Has Value Exception Linq to SQL When Assigning Null
- Is a full list returned first and then filtered when using linq to sql to filter data from a database or just the filtered list?
- LinQ to SQL throws Stackoverflow exception when using Any()
- Linq to sql as object data source - designer problem with partial classes
- linq to sql + stackoverflow exception when querying objects
- Getting wrong data from SQL view when putting it into a C# list
- LINQ - changing Data Source (and the LINQ Provider) at runtime in C#
- Linq Query Exception when filtering data
- DataContext not visible when choosing data source for LinqDataSource
- Getting error when fetching data from Sql server compact using linq
- Display Message When No Data Found Using Linq to Sql using C#
- Error when trying to delete data from table with LINQ to SQL
- Having an issue with a null exception on WPF DataGrid when trying to display data from a database with Linq
- Handling Null Exception in Linq to Sql on a binary data type column
- How to search for FirstName + Lastname from sql data base when input is full name with entities in c#?
- How to format your data on a record when using linq in sql asp.net mvc 5?
- "System.InvalidCastException" error when retrieving data from SQL Server 2012 Express
- What can I do to resolve a "Row not found or changed" Exception in LINQ to SQL on a SQL Server Compact Edition Database?
- Purpose of EF 6.x DbContext Generator option when adding a new data item in Visual Studio
- The data source does not support server-side data paging
- When should I dispose of a data context
- How can I use Nhibernate to retrieve data when the "WHERE IN()" have thousands of values? (too many parameters in the sql)
- Why does LINQ query throw an exception when I attempt to get a count of a type
- Entity Framework filter data by string sql
More Query from same tag
- How to get all elements except the n'th element in a List using Linq
- MVC4 return a stored procedure output with linq to sql
- linq lambda expression and '&' operator
- Any() method on List<DateTime> doesn't work as per expectation
- Linq to SQL column computed from query to different table?
- Based on date, get todays and the next two days values from XML?
- Fetch data from big table based on big list of items
- C# LINQ : Dynamically create property and values that includes sum of a value from a grouped query
- Entity Framework related objects using generics
- Entity Framework LINQ - Subquery with Group By
- json Cannot access child value on Newtonsoft.Json.Linq.JValue
- Issue with Mock repository
- How to reformat Datetime when retrieving it from database using linq
- How to read data chunk wise into memory from the database?
- Running a BackgroundWorker within another BackgroundWorker
- Handling Null Exception in Linq to Sql on a binary data type column
- Using Linq to pass data from one collection to another
- Query on other query linq
- Need to order data with two fields Linq
- Errors translating Linq expression to URI: The method 'Select' is not supported
- LINQ query question, needs joins
- What would be the best way to get all the products in all the child categories of a selected main category?
- How to detect that a datatable is a part of another datatable
- Need Json Response to be queried and bind to modal view
- How to use the Exact array value instead of Contains
- Are there any easy way to select in linq
- Linq statement for Orders reporting
- Enumerating updated lists
- How to get biggest element in HashSet of object by field?
- LINQ group by maxcount