Mid From PDF LINQ LINQ

How to get employee with maximum salary in a department?

How to get employee with maximum salary in a department?

var maxSalaryInIT = employees

.Where(e => e.Department == "IT")

Follow :

.OrderByDescending(e => e.Salary)

.FirstOrDefault();

Console.WriteLine($"{maxSalaryInIT?.Name} has the highest salary in

IT");

More from LINQ Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details