score:3

Accepted answer

it would be something like this:

dim joinedresult = from t1 in table1 
    group join t2 in table2 
       on t1.key equals t2.key 
       into righttableresults = group 
    from t2 in righttableresults.defaultifempty 
    select t1.prop1, 
       t2.prop2        

i'm not a vb guy (anymore), but i think this would work.

score:0

you can simply use the existing join method

public static ienumerable<tresult> join<touter, tinner, tkey, tresult>(
    this ienumerable<touter> outer,
    ienumerable<tinner> inner,
    func<touter, tkey> outerkeyselector,
    func<tinner, tkey> innerkeyselector,
    func<touter, tinner, tresult> resultselector
)

eg:

table1.join(table2, t1 => t1.key, t2 => t2.key, (t1, t2) => new { table1 = t1, table2 = t2 });

can find more overloads and examples http://msdn.microsoft.com/en-us/library/system.linq.enumerable.join.aspx

pardon me for c# examples


Related Query