Filter a LINQ query

Posted by Jack Marchetti on Stack Overflow See other posts from Stack Overflow or by Jack Marchetti
Published on 2010-06-18T13:59:45Z Indexed on 2010/06/18 14:03 UTC
Read the original article Hit count: 397

Filed under:
|
|
|

Here's my query.

var query = from g in dc.Group
            join gm in dc.GroupMembers on g.ID equals gm.GroupID
            where gm.UserID == UserID
            select new {
                id = g.ID,
                name = g.Name,
                pools = (from pool in g.Pool
                // more stuff to populate pools

So I have to perform some filtering, but when I attempt to filter

var filter = query.Where(f => f.pools.[no access to list of columns]  

I can't access any of the items within "pools". Does anyone know how I'm able to access that?

What I'd like to do is this:

var filterbyGame = query.Where(f = > f.pools.GameName == "TestGame");

Let me know if that's even possible with thew ay I have this setup.

Thanks guys.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET