List Join?? How can I do this?

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I have to lists: List<Role> A and List<Role> B. Role is an
enumeration.

I want to update list A as follows:
- The elements in list A are not changed.
- The elements in list B that do no exist in list A are added to list
A.

How can I do this?

Thanks,
Miguel
 
shapper said:
Hello,

I have to lists: List<Role> A and List<Role> B. Role is an
enumeration.

I want to update list A as follows:
- The elements in list A are not changed.
- The elements in list B that do no exist in list A are added to list
A.

How can I do this?

Thanks,
Miguel

Create a HashSet from list A. Loop through list B and each value that
doesn't exist in the HashSet you add to list A.
 
Back
Top