I’ve data in two ArrayList arrayListA and arrayListB.
I want to do a check if there is a difference between these two arrayLists.
so i do this in the code :
ArrayList diff = new ArrayList();
foreach (string[] a in arrayListB)
{
if(!arrayListA.Contains(a))
{
diff.Add(a);
}
}
so my problem here when I run the program. All data in arrayListB is added into ArrayList diff. It should only add the data that is only in arrayListA and not arrayListB, correct?
what is going wrong?
This is the result after i run the program. The listbox a is data in arrayListA, listbox B is data in arrayListB and listbox diff is data from diff.

I already enter System.Linq.
but i don’t get “Where” properties for my List.

First of all, it would be easier to work with List:
Now you can use Linq to get the ones that are in A but not in B, and the ones that are in B but not in A, and combine those to get the complete difference:
Translation of the code above, with simple loops and longer code is: