Thursday, November 25, 2021

Find 2nd ,3rd or Nth Highest salary using LINQ


var Customer = Customers.OrderByDescending(x => x.salary)

.Select(x => x.salary).Distinct().Take(NthNumber_Salary)

.Skip(NthNumber_Salary - 1).FirstOrDefault();  

 Console.Write("3rd Highest Salary is: " + ee);

No comments:

Post a Comment