|
-
Sep 22nd, 2014, 12:31 PM
#1
Thread Starter
Frenzied Member
Help with LINQ query
Hi!
I need to create a LINQ query that flattens a list of nested objects into a list that I can easily bind to a gridview.
The object hierarchy looks like this
Factory A
* Client 1
* CLient 2
Factory B
* CLient 3
* CLient 4
The factory is a very simple class, it has two properties a string property for Name and a List(of Client) called Clients. The Client class has three properties: string Name int Location and int Id
I want to create a flat list of anonymous objects that look like
FactoryName
ClientName
ClientId
ClientLocation.
I have spent the past hours trying to figure this out, and it should be really simple, like using the SelectMany() extension method, but I can't get the contexts in the LINQ query correct, so I can select both the name from the Factory class, and the other properties from the Client class.
help me out here!
thanks
Henrik
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|