forum

Home / DeveloperSection / Forums / How to linq join with groups?

How to linq join with groups?

Anurag Sharma222804-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 = newIEnumerable<SomeClass> { ... };
var rows = newIEnumerable<SomeOtherClass> { ... };
var makedGroups = rows.GroupBy(row => row.SomeId);
var groupsJoined = (from row in makedGroups
    join allocQuant in f on row.Key.Value equals allocQuant.SomeIdinto 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?


Updated on 04-Nov-2014

Can you answer this question?


Answer

1 Answers

Liked By