I already have my two lists:
List<Clase1> Clase1 = new List<Clase1>();
List<Clase2> Clase2 = new List<Clase2>();
In both lists I have 5 fields (Order, Line, order2, Paint, Quantity) and I need by order number, Line and paint to compare if any of list 2 coincides with 1, in case of coincidence I need to subtract the quantity from 2 list with the first one to see if it has more or less amount of paint or if they are the same in both lists.
I don't have enough reputation to comment, so I'm writing it as an answer. I have done a test with the information we have (if anyone can improve the code, feel free to do so):
Lessons:
The function:
Code Comments:
The function is based on iterating the list of class1 and comparing using a linq command which returns the first matching object in the list of class2. The try is necessary, because if it doesn't find one that matches, the Linq throws a null exception. The quantities between the two classes are then compared and the condition of the quantities is determined. In my case, since it was by console, I used a StringBuilder to do the output at the end.
Output: