linq - Referencing outer SelectMany parameter from inner Select -
i thought had got work before, don't see it:
discounts dictionary<parttype, double>
. data list<parttype>
.
var d = discounts.keys.selectmany( k => data.where( l => l.parttypeid.equals( k.parttypeid ) ) ) .select( s => new { k, l } );
the error is, name 'k' (and 'l') not exist in current context.
what want apply double
dictionary matching parttypes in data.
i suspect mean:
var d = discounts.keys.selectmany( k => data.where(l => l.parttypeid.equals(k.parttypeid)), (k, l) => new { k, l });
... it's hard tell without more information. honest looks want join, e.g.
var d = discounts.keys.join(data, k => k.parttypeid, // key discounts.keys l => l.parttypeid, // key data (k, l) => new { k, l }); // projection 2 values
Comments
Post a Comment