Linq remove duplicate records as per column values C# -
i have class items
properties id, name, action
.
the list of items
populated duplicated items.
for example:
1 item1 it00001 insert 2 item1 it00001 delete 3 item3 it00003 insert 4 item4 it00004 update
how remove duplicates in list using linq? output be
3 item3 it00003 insert 4 item4 it00004 update
you can linq:
var filteredlist = list.groupby(o => o.name) .where(g => g.count() == 1) .selectmany(g => g.select(o => o)) .tolist();
Comments
Post a Comment