Skip to main content
Convert IEnumerable back to List (thanks @QaAutomator)
Source Link
200_success
  • 144.2k
  • 22
  • 188
  • 473

The operation is called the symmetric difference of List1 and List2. You can write

desiredList =return list1.Except(list2).Union(list2.Except(list1)).ToList<string>();

The operation is called the symmetric difference of List1 and List2. You can write

desiredList = list1.Except(list2).Union(list2.Except(list1));

The operation is called the symmetric difference of List1 and List2. You can write

return list1.Except(list2).Union(list2.Except(list1)).ToList<string>();
Source Link
200_success
  • 144.2k
  • 22
  • 188
  • 473

The operation is called the symmetric difference of List1 and List2. You can write

desiredList = list1.Except(list2).Union(list2.Except(list1));