using System.Collections;
using System.Collections.Generic;
public static void Main()
List<Thing> listThings = new List<Thing>() {
new Thing(1,"Did action A",1),
new Thing(1,"Did action B",2),
new Thing(1,"Did action C",3),
new Thing(2,"Did action A",1),
new Thing(2,"Did action B",2)
List<int> userNums=listThings.Select(x => x.UserNumber).Distinct().ToList();
List<Thing> listFilteredThings = new List<Thing>();
foreach(int i in userNums){
List<Thing> tmp = listThings.Where(x => x.UserNumber==i).ToList();
listFilteredThings.AddRange(tmp.Where(x => x.ActionNum==tmp.Max(y => y.ActionNum)).ToList());
foreach(Thing thing in listFilteredThings){
Console.WriteLine(thing.UserNumber +", " + thing.Name);
public Thing(int userNum, string name, int actionNum){
this.ActionNum=actionNum;