Click here to Skip to main content
15,749,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two classes MenuItems(ID int, ...., Icons_IconID int) and Icons(ID, ...) and I want select the data from the database and store the data in the objects that are related. Like:
Menu: File
MenuOrder: 1
Icon: FileIcon

How can I do that?

What I have tried:

I was trying to use List within List, but couldn't think of a feasible solution on how to implement that. Please help
Updated 10-Oct-16 21:03pm

1 solution

Why not design the class to hold the "sub class" instances:
public class MenuItem
   public int ID { get; set; }
   private List<Icon> _Icons = new List<Icon>();  
   public List<Icon> Icons { get { return _Icons; }}
Then all you need is a List<MenuItem> to hold them all.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900