Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Remove an element from one list who matches another element from another list

I have two list with the next values:

List A:

  • ‘9999’
  • ‘1111’

List B:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

  • ‘1111’

I want to remove from List A the element who matches with anyone of the list B. In this case
list A (or a new list) should have:

List C:

  • ‘9999’

I was looking for an optimus way of do it but I can’t find anyone. Any suggestion?

>Solution :

I am not sure if this is what you are looking for:

List<Integer> result = listA.Except(listB).ToList();
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading