I have 2 lists that I am trying to compare, sadly they are not of the save class. One is from the magento api and the other is a custom class containing some values from the other. (only the ones that I need)
if (existingPhotoOrders.Where(x => x.OrderNumber.CompareTo(order.increment_id) == 0).ToList().Count > 0)
continue;
There is a problem with the API where I have to get all the orders and compare the ones that I want and then request individually extra information but the above query is not working it is just continueing with everything.
I have looked at other comparisons but they all require the classes to be the same. If anyone could shed some light I would be grateful.
It can be re-written like so using the
Anymethod:As to why it is always continuing, the expression must always be true! I presume the requirement is
if the order increment id is not an order number of an existing order then continue, in which case, you can use theAllmethod:Or as a more performant alternative: