score:2
You can use this query:
listA = listA
.OrderBy(a => listb.FirstOrDefault(b => b.ID == a.objectB_id)?.Date ?? DateTime.MaxValue)
.ToList();
This might not be the most efficient approach but it is safe. Because if you use Join
it's possible that you get duplicate ObjectA instances if there are duplicate OBjectB(acc. to the ID).
Source: stackoverflow.com
Related Articles
- Order one list with a parameter from another list, with a joinable parameter
- Create list of dynamic objects with order and columns from another list
- Remove items of list from another lists with criteria
- Check if one list contains all items from another list in order
- Creating a list with elements count dependable from the another list
- C#- Select specific items from a list based on partial intersection with another list (Linq + Lambda)
- How can I get data from a list with a where clause to another list?
- How to get Sum from List in another List as a property with linq
- Populate a large list of objects with details from another list
- Remove an object from a list based on an attribute of another list with linq
- Remove Items from sub list matching another sub list with Linq
- Update List from another List with Matching values using Linq
- Linq query for updating list of objects with some data from another list of objects
- How can I update the contents of a list with data from 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
- How to use LINQ to retrieve a list from another entity with a specific number of items
- Update existing list values with values from another query
- How to order data with matching ID from another table using linq?
- C# - Filling List with LINQ from another List<>
- How to assign a field in object list with a corresponding item from another using LINQ?
- Select from one list only those present in another and order by second list - linq
- c# Linq or code to extract groups from a single list of source data
- Compare the item from one list object with another item from another list object
- Linq - how to replace a lists property with value from another list where both keys are equal
- Linq query, select everything from one lists property that starts with a string in another list
- Updating One List with values from another list based on a condition
- Select item from one list based on item in another list in the same order
- How to construct a LINQ Query to test a list against another list where elements start with the elements from the other
- Linq: add objects from one list to another with an other type, (MVC, C#)
- From Linq To List Using Extension Method
- Group by JsonDocument's property with unknown type using Entity Framework Core
- Error when trying to delete data from table with LINQ to SQL
- How to select two columns in one int array
- How to use Linq to select and group complex child object from a parents list
- Lightswitch 2013 Linq queries to Get min value
- Pre Operation Concurrent Plugins Getting MAXIMUM Existing Field Value For An Entity Records
- How to flatten a dictionary<string,List<string>> in linq and keep the key in the results
- Cannot implicitly convert type 'int?' to 'System.Collections.Generic.List<Model>
- Selecting column/field of object collection and exporting as List<>
- Variable assignment to first item in IEnumerable does not work
- Linq preprocessor?
- LINQ Select New
- Fetching value from a datatable into datatable with where clause
- How can i do DRY for many similar joins in LINQ?
- Using Linq to look for gap in dates
- How to pass multiple Expressions to OrderBy for EF?
- How to assign a field in object list with a corresponding item from another using LINQ?
- Remove Duplicate Rows and Count in C# DataTable
- LINQ query left join multiple columns with null check failing