Hi and thanks so much for answering and trying to help me out. None of the answers so far actually solves my problem just by copy&paste though, so I haven't accepted any of the answers - sorry!
However, the following code selects distinct product codes from the above classes
var productCodes = from o in orders
from l in o.OrderLines
productCodes = productCodes.Distinct();
foreach (var code in productCodes)