I have a class, let's say as below:
public class Customer{
public string Name;
public int Score;
}
So, I have a list of customers. Customers may have same name with different Scores. Now I want to get the customer with the maximum Score if the name is same.
For example:
var customers = new List<Customer>()
{
new Customer() { Name = "Rahim", Score = 30 },
new Customer() { Name = "Rahim", Score = 25 },
new Customer() { Name = "Karim", Score = 49 },
new Customer() { Name = "Aziz", Score = 24 },
};
The output should be,
Rahim 30
Karim 49
Aziz 24