With EF or LINQ to SQL:
var item = db.Items.OrderByDescending(i => i.Value).FirstOrDefault();
With LINQ to Objects I suggest to use morelinq extension
MaxBy (get morelinq from nuget):
var item = items.MaxBy(i => i.Value);
- How to find item with max value using linq?
- How to find max value for each column using LINQ (vb.net)
- Select List<T> item with max value using LINQ query
- how to select records from multiple table with max count value from one table using Linq in Asp.net MVC C#
- How to get distinct with highest value using Linq
- Using LINQ, how do I find an object with a given property value from a List?
- How to find the first item according to a specific ordering using LINQ in O(n)?
- DataTable: Get Max Value Using LINQ With Criteria Field (GroupBy)
- How go get max value of a unique id column using LINQ
- Using Linq 2 EF, how would I find a guid starting with 'x'?
- How to find specific item with Linq based on multiple conditions?
- How can you use LINQ to find Azure AD users with specific licenses using the Azure AD Graph API Client Library 2.0
- c# find item in list returned by LINQ query and compare its value with another item in list
- C# Using LINQ to filter each Object with Max Value in List of Objects
- Using ASP.NET and MVC 3, how can I create hidden fields so that a List with an array as a value of each item in the list binds correctly?
- How do I find max date for matching entities by entity.ids using linq
- How to find the last item from list have the same item using linq
- Can't add a new record with an integer value into database by using linq from code C#
- How to find the first parent in a tree-like hierarchy using LINQ with EF Core
- Generically find any items where item property value is equal using LINQ
- How to set a value in one list when comparing it with other list using LINQ
- How to merge two lists while adding metadata indicating value source with LINQ statement?
- How to Find a DataTable Row by Column Value Using LINQ in VB.NET
- How do I select the item with the highest value using LINQ?
- How to get list of keys in a dictionary with group by value with using LinQ
- How to find the top number between a range given a value from a table using LINQ
- How to find subsets with exact length using linq lambda syntax
- How to find all items in a list where a property has a specific value or where there is a related item with this value?
- How to find an item in a dbset using linq
- C# XML File: How to select a node with a certain value using LINQ
More Query from same tag
- Linq union all equivalent of sql code
- Optimized code for Insert and Update in one method with LINQ?
- Will this Post/Tag DB schema cause problems later?
- LINQ OrderBy / ThenBy with conditional sorting
- Best way to remove elements from list field of list objects
- Running a Contains operator in Azure Table Service linq query
- Convert observablecollection of paths into collection of filenames
- Sequence contains no elements - LINQ, MVC, Average
- Linq to Entities Non-Equal Join
- Setting value of object property in List<T> using LINQ
- Translating expression tree from a type to another type with complex mappings
- How to distinguish between a found 0 and default(int) when using methods like FindLast?
- Max(x=>x.Time) vs OrderByDescending(x=>x.Time).First().Time
- Translating a subquery in a WHERE clause into LINQ
- Select with just added property
- C# linq anonymous include
- How to convert Dictionary <string,List<string>> in C# to csv with keys as headers?
- Group Sequential List By Key
- How to get data from xml, by linq, c#
- C# Linq merge two dictionaries
- Distinct all columns in a datatable and store to another datatable with LINQ
- Best way to get all words like @*@ from a string in C#
- How do I use linq to check if an element has the correct child in XML C#?
- aggregate list with linq with sum
- Linq Method error
- Entity Framework: How to perform left join with EF and LINQ among multiple tables
- LINQ won't sum a group with a float? property
- EntityFramework 6.1.1 with Linq Performance issue
- How to cut some elements from the middle of the sequence?
- Is it possible to implement a "Smaller Numbers than Current" using a single LINQ query?