I’m generating two IEnumerable<int> objects:
var listA = model.SelectedFormats.Select(a => a.ID); //values: 1,2,4
var listB = basket.OrderPosition.Select(x => x.BookFormatTypeID); //values: 1,4
var result = listA.Except(listB);
but I can’t see any results from the Except method (the compiler doesn’t show even that the
result is)
IEnumerable.Except()does not return elements directly, it returns anIEnumerablewhich you can access to iterate over the result.You could change the last line to
This would automatically iterate over the elements and add them to a list, allowing you to inspect the result.