use entity framework to get the highest value from a column named "high_score" in csharp

You can use Entity Framework to get the highest value from a column named "high_score" in the following way:

main.cs
using (var context = new YourDbContext())
{
    var highestScore = context.YourTable.Max(x => x.high_score);
}
111 chars
5 lines

First, create a new instance of your DbContext. Then, use the Max method on your table to get the highest value of the high_score column. Store the result in a variable to use later.

gistlibby LogSnag