forum

home / developersection / forums / how to linq join with groups?

How to linq join with groups?

Anurag Sharma 2680 04-Nov-2014

Hej, i've got a problem with linq expression. I Would like to perform join with groups of some set. This is basicly what I need:

var f = new IEnumerable<SomeClass> { ... };
var rows = new IEnumerable<SomeOtherClass> { ... };
var makedGroups = rows.GroupBy(row => row.SomeId);
var groupsJoined = (from row in makedGroups
    join allocQuant in f on row.Key.Value equals allocQuant.SomeId into gj
    select gr => new { Count = gr.Count(), Group = gj });


error is: Error 202 The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'Join'.

How to write this expression properly?


linq c#  join 
Updated on 04-Nov-2014
Can you answer this question?

Answer

1 Answers

Liked By