I have the following code:
List<byte[]> list1 = new List<byte[]>(); list1.Add(new byte[] { 0x41, 0x41, 0x41, 0x41, 0x78, 0x56, 0x34, 0x12 }); List<byte[]> list2 = new List<byte[]>(); list2.Add(new byte[] { 0x41, 0x41, 0x41, 0x41, 0x78, 0x56, 0x34, 0x12 }); list2.Add(new byte[] { 0x42, 0x42, 0x42, 0x42, 0x78, 0x56, 0x34, 0x12 });
I want list3 to contain only byte [] arrays that are in list2 but not in list1 (the one marked as "this array"), but instead it just returns the whole list2. So, I tried the following:
List<byte[]> list3 = new List<byte[]>(); foreach (byte[] array in list2) if (!list1.Contains(array)) list3.Add(array);
but it gave me the same result. What am I doing wrong?
source share