score:2
Accepted answer
orders.orderlines.removeall(o => o.products.any(p => p.usebydate > datetime.now))
score:1
foreach(var order in orders.orderlines) {
bool isvalid = true;
foreach(var product in order.products) {
if (datetime.compare(product.usebydate, datetime.now) > 0) {
isvalid = false;
}
}
if (isvalid = false) {
orders.orderlines.remove(order);
}
}
Source: stackoverflow.com
Related Query
- how to use Except or Remove method based on nested list condition
- Remove item from list based on condition
- Remove Duplicate item from list based on condition
- How to use a LINQ in order to remove Min and Max value in List
- How to Remove elements from one List based another list's element and condition?
- use LINQ to remove items from a list based on a date
- How can i copy data table records of different field name based on mapping list evaluating condition on source data table?
- How to remove duplicate items in recursive nested list
- Remove list from a list in C# based on specific condition
- Use linq to remove elements in one list using a condition in another
- How to use LINQ remove a subset of list with certain criteria?
- How to include list based on a condition in LINQ
- How to update a list based on more than one Condition using LINQ C#
- How to create an EF query which returns a nested list with navigation properties based on different entity ids?
- How to use a LINQ : If there are several min and max values, just remove only one min and max value in List
- How to remove duplicates from a list of nested objects?
- How to optimize method with nested if condition
- How to use Expressions to invoke a method call with a generic list as the parameter?
- How to use Linq where condition to check if a list of strings contains any string
- How to order the items of a list and remove duplicates based on a property?
- USe LINQ to remove from a list based on conditions
- Linq how to filter an object list based on overlap of nested list property and external list
- How to select an entity from database based on nested list item match?
- How to use condition in LINQ take() method
- How to remove duplicate elements in a list using LINQ based on a custom condition?
- How to use Linq to update fields in a list based on another list joined by id
- How to use two substring() method in join condition in linq
- How to remove multiple elements from list based on another list without creating new instance?
- How to use Linq on IList, to compare first value and second value present on the list based on some conditions.?
- Nested List how go step by step based on what button was clicked
More Query from same tag
- Show subset of data in MVC3 view page
- How can i improve this with linq?
- Get the Substrings within the List<string> collection using Linq
- Select latest item in list except when property has a certain value
- LINQ error to select a column from the table
- c# Linq - Check if composite key exists in another list
- Efficient way to merge table like datastructure using linq
- distinct in the two list
- How to convert nested foreach loops with conditions to LINQ
- Need help rewriting this Linq query to move it from code-behind to DAL as reusable object
- LINQ to remove objects from a list of objects based on another list of objects
- Build an lambda Expression tree with a specific field in a linked entity
- Dynamic query with OR conditions in Entity Framework
- Lambda/Linq Error "an Item with the same key has already been added"
- Getting property value based on its column attribute value
- Select single column as list from existing list using fieldname as string
- Linq: using let statement based on string to group data
- LINQ Group results and select from another table
- How to split string by delimeter and multiple group by and count them in Linq?
- Converting generic collection sort to utilize Linq
- how to combine two data source into one?
- Linq query works with null but not int? in where clause
- Linq to XML - SmarterMail API response to jQuery dataTables
- In clause in linq expression
- Is there a dumb "all" in linq that evaluate all element?
- LINQ Returning string array from DB.ExecuteQuery
- linq where statement subject to a checkbox value
- error when create an expression
- c# Linq filter out records from a list within a dictionary
- many to many linq query with like expression