Generate a Collection with sub collection from XML data

Hey all, This is a very simple example, but very useful when you develop business applications; The example has a sample XML data, and this is read to a collection; since, the XML data is having a parent ID, the collection is modified in such a way that it accepts the parent id and generate a sub class for the collection; Check the example

e.g.

retVal = GetMenuByOrder(menuItems.ToList());

Here, in the above code, menuItems is a collection which has ID and Parent ID; GetMenuByOrder will return a new collection with SubMenuItems;

Download source code

Comments