I thought I had got this to work before, but I just don’t see it:
discounts is a Dictionary<PartType, double>. data is a List<PartType>.
var d = discounts.Keys.SelectMany(
k =>
data.Where( l => l.PartTypeID.Equals( k.PartTypeID ) ) )
.Select( s => new { k, l } );
The error is, the name ‘k’ (and ‘l’) does not exist in the current context.
What I eventually want to do is apply the double from the dictionary to all the matching PartTypes in data.
I suspect you mean:
… but it’s hard to tell without more information. To be honest it looks like you really want a join, e.g.