I have the following query:
var groupCats = from g in groups group g by g.Value into grouped select new { GroupCategory = grouped.Key, Categories = GetCategories(grouped.Key, child) };
It works great. In the returned anonymous type, GroupCategory is a string and Categories is Enumerable - what is the proper way to declare this instead of using "var"?
I tried:
IGrouping<string,string> groupCats = from g in groups group g by g.Value into grouped select new { GroupCategory = grouped.Key, Categories = GetCategories(grouped.Key, child) };
and
IGrouping<string,Enumerable<string>> groupCats = from g in groups group g by g.Value into grouped select new { GroupCategory = grouped.Key, Categories = GetCategories(grouped.Key, child) };
In both cases, I get:
Impossible to convert type implicity .... Explicit conversion exists (you are missing a cast)
How to do it?
source share