Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Obtaining like records
Message
From
22/10/2011 10:15:05
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
 
 
To
22/10/2011 09:29:09
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
LINQ
Environment versions
Environment:
C# 3.0
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01527091
Message ID:
01527093
Views:
45
>I have a list that contains objects of a given class type which contains just a few properties. Two of these properties are:
>string property called "Code"
>string property called "HOCReason"
>
>This list can contain any number of items from 0 to n most likely not more than 10 or 12 records. I need to show them in a parent / child manner where I group all the records with the same Code together as the parent, and then show the children as only the HOC Reasons for those Code types. I am programmatically adding these values to a treeview control. Is there a linq way to obtain these from my List?
>Timothy
>
>Svc_Code: 8FL Description: blah blah blah
> HOC Reason: Whatever the reason is for this one
> HOC Reason: Whatever this other reason may be
>Svc_Code: 6SD Description: Some other description for this
> HOC Reason: Some description for this item

Check the third example: http://msdn.microsoft.com/en-us/vcsharp/aa336754.aspx#nested

Looks like it does what you need to do.
Very fitting: http://xkcd.com/386/
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform