-1
            List<string> list1 = new List<string> {"jos", "eva"};
            List<string> list2 = new List<string> { "jos", "eva", "bart"};

            //Result
            List<string> list3 = new List<string> { "jos", "eva", "bart"};

i need to compare 2 lists of the same type and i need to get a new list with all the values but no value can be dubble in the new list. i tried already with a a dubble for each but the result is to big.

1 Answers1

-1

Import System.Linq.

Use Enumerable.Concat() to concatenate two or more lists.

On the new merged list instance, use Distinct() to get a list of values without duplicates in it.

Read:

Rivo R.
  • 351
  • 2
  • 8