Accepted answer

if i understand correctly you can try to use linq union combine those collections then use groupby and sum get your expect result.

list<monster> lista = new list<monster>();

lista.add(new monster(0, "snails", 600));
lista.add(new monster(1, "slimes", 300));

list<monster> listb = new list<monster>();
listb.add(new monster(0, "snails", 72));

list<monster> listc = new list<monster>();
listc.add(new monster(0, "snails", 300));
listc.add(new monster(1, "slimes", 371));
listc.add(new monster(10, "trolls", 152));

var reuslt =  lista
        .groupby(x => new { x.index , })
        .select(x=> new monster(x.key.index,,x.sum(z=>z.count)));

c# online


index:0  name:snails  count:972
index:1  name:slimes  count:671
index:10 name:trolls  count:152

Related Query

More Query from same tag