I have 2 lists I am trying to compare. I execute the following and I get a false value returned:
var areIdentical = list1.SequenceEqual(list2, myFileCompare);
That part is working. My lists are NOT equal. The problem is, I’m using the following command to try to find the differences:
var fileDiff = (from file in list1
select file).Except(list2, myFileCompare);
My problem is, fileDiff is returning an empty result set. Since I know they are NOT identical, shouldn’t I get something returned? Perhaps my query is wrong on this. Any help would be appreciated! By the way, I can post more of my code, if you really need it, however, this should suffice.
You wouldn’t get anything if:
list2contained everything inlist1but also extra itemsAssuming you don’t care about the ordering, you can use:
If you do care about the order, you’ll need to work out exactly how you want the differences to be represented.