I had written the following code for comparing two tables,
var one = db.arabia_upod_item_availability_masters.Where(i => i.locationId == 30).OrderBy(i => i.itemNo).ToList();
var two = db.vw_get_arabia_upod_report_quantityOrderedPerItem_uhjs.OrderBy(i => i.Item_No).ToList();
if (one.Zip(two, (j, k) => j.itemNo == k.Item_No).Any(m => !m))
returnValue = true;
else
returnValue = false;
The problem is that the Zip method loops from first to last and then again first. For eg, if item no’s are 1,2,3 it goes through 1,2,3 and then again 1 and it even returns false even though all the values match. What can be the problem? Please help me.
Zip is a combining operator: it combines items from
Onewith items fromTwothat are in the same position in the list. It seems to me you expect it to combine according to the filter.