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 Query
- Order one list with a parameter from another list, with a joinable parameter
- Check if one list contains all items from another list in order
- Create list of dynamic objects with order and columns from another list
- Select from one list only those present in another and order by second list - linq
- Compare the item from one list object with another item from another list object
- 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
- Linq: add objects from one list to another with an other type, (MVC, C#)
- Remove items of list from another lists with criteria
- Create a list of one object type from a list of another using Linq
- Exclude items of one list in another with different object data types, LINQ?
- Check if one list contains any elements from another
- Using Linq query inside List<T>.AddRange to conditionally add elements from one list to another
- Assign values from one list to another using LINQ
- Linq - Except one list with items in another
- How to include one specific row from another table with LINQ to Entities
- Adding only new items from one list to another
- Copy one List to another List and SubList with LINQ
- Creating a list with elements count dependable from the another list
- LINQ in C#. Check if one list contains elements from another one
- C#- Select specific items from a list based on partial intersection with another list (Linq + Lambda)
- Copy a list of objects to another typed list in one line of code
- How to Remove elements from one List based another list's element and condition?
- How can I get data from a list with a where clause to another list?
- Assign Values from one list to Another list based on Id
- Using the Iqueryable list result from one query as the parameter for another?
- How to get Sum from List in another List as a property with linq
- what is the most elegant way to update an item in one list from another list in C#?
- Using LINQ to copy data from one list to another
More Query from same tag
- LINQ to Entities does not recognize the method 'Int32 ToInt32(Boolean)'
- How to implement custom LINQ Provider for decorator?
- Counting Database records that meet criteria and displaying in view
- How can I get the following collection to return the original type?
- Group two lists by a common user id linq
- Fill ComboBox with Results of LINQ Query, Directly
- C# and LINQ.XML Select from XML
- C#: Iterating through a data table: Rows, Select() or AsEnumerable()
- How do I write a linq to sql query to find records where field name can match one of dynamic number of strings?
- How to mock a 3rd party web service LINQ data provider?
- Looping through the properties of an IQueryable
- Problem with Nullable field in Linq stored procedure + crystal reports on VS2008
- Left outer join in LINQ
- What is the equivalent of XML PATH and Stuff in Linq lambda expression (GROUP_CONCAT/STRING_AGG)?
- ASP.NET MVC 4 - Using Linq to read databse once & use multiple times
- LINQ: Get an item that is not in the records - C#
- Entity Framework lazy load
- Calling methods from different Projects in one Solution
- Context Disposed Error before DropDownListFor() get populated
- How|Where are closed-over variables stored?
- Calling sproc from LINQ with an xml parameter
- LINQ Join Query Structure Resulting in CS0119 Error
- Does deleting from a LINQ DB also delete records in other tables that have a foreign key association?
- LINQ to Entities does not recognize the method 'System.String ToString()' method and this method cannot be translated into a store expression
- How can I use LINQ to find a DataGridView row?
- Use LINQ to get only the most recent JOINed item for each element
- How do I create a shallow copy of an IEnumerable<T>?
- How to optimize LINQ OrderBy if the keySelector is slow?
- LINQ query with multiple joins and contains is not working
- Linq query for children class by Entity framework