Given the following code:
var people = new List<person>(){ new person { Name = 'John', FamilyName = 'Pendray' }, new person { FamilyName = 'Emery', Name = 'Jake'}, new person { FamilyName = 'Pendray', Name = 'Richard' } }; var q = from p in people orderby p.Name group p by p.FamilyName into fam orderby fam.Key select new { fam.Key, members = from p in fam select p };
Is it possible to replace the last line with a select that will output a IEnumerable<string> that contains these two strings: ‘Pendray John Richard’ ‘Emery Jake’? Is it possible to project a linq query into strings like this?
Edit: I know this is possible with further code but I’m interested in whether this can be done from within the linq query itself in a similar way to VB being able to project xml out of a query as in http://www.thinqlinq.com/default/Projecting-XML-from-LINQ-to-SQL.aspx (particularly the last code block on this page)
Returns
Emery JakePendray John Richard