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

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -