C# – LINQ – Remove duplicates from a list and ignore values from another list

My idea for the blog was to post some articles every now and then. But at least, I am trying to keep up to a schedule of minimum 1 article per week, to keep it alive. Thus, I have decided to show some further steps with LINQ in C#.

The idea is that we have two lists – one with initial data, that contains duplicates.


The second list is with data, that contains values, which should be ignored from the list. Looks like a simple outer-left-join with SQL, but here, we have LINQ. Thus, we have to use the “=>” sign at least twice. I have created two examples – the first one is just with a single ignored value, and the second one is with a whole list of ignored values. Concerning the performance, I am not sure that it is quick enough, but still it works:

Here comes the code in GitHub as well.

Tagged with: , , , ,