I have two lists and I want to compare them and get the differences, while ignoring any case differences.
I have used the following code to get the differences between the two lists but it does not ignore case differences.
IEnumerable<string> diff = list1.Except(list2);
List<string> differenceList = diff.ToList<string>();
I tried this:
IEnumerable<string> diff = list1.Except(list2, StringComparison.OrdinalIgnoreCase);
but Except does not seem to be having a string case check of that sort (so error). I'm hoping there's a work around.
Here's what worked:
IEnumerable<string> differenceQuery = inputTable.Except(strArrList,
StringComparer.OrdinalIgnoreCase);
Used StringComparer
instead of StringComparison
.