I\'am trying to check the difference between two List
in c#
.
Example:
List FirstList = new List
Try to use Except LINQ extension method, which takes items only from the first list, that are not present in the second. Example is given below:
List ThirdList = SecondList.Except(FirstList).ToList();
You can print the result using the following code:
Console.WriteLine(string.Join(Environment.NewLine, ThirdList));
Or
Debug.WriteLine(string.Join(Environment.NewLine, ThirdList));
Note: Don't forget to include: using System.Diagnostics;
prints:
COM3