How can I do this conversion? Is it possible with some simple LINQ query?
+1
A:
If V is some other type not involved in the query, you can use the let keyword to create an instance and then group on it...
from x in Y
let v = new V(x.Whatever)
group v by v.Whatever into vGroup
select vGroup
Will
2010-04-06 19:18:00
A:
Assuming that V inherits from U and you want to cast each U to a V :
IEnumerable<IGrouping<string, U>> groupingsOfU =
from u in listOfU
group u by u.Foo;
IEnumerable<IGrouping<string, V>> groupingsOfV =
from g in groupingsOfU
from u in g
group (V)u by g.Key;
Thomas Levesque
2010-04-06 21:50:07