In VB.NET 2010, How would one go about creating a list of Parent classes where each Parent has it's own list of Child classes. Where the list of child classes could be as few as 1 child or as many as a few hundred child objects?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Dim ChildList as generic.list(of object)
Dim ParentList as generic.list(of ChildList)
You can do it like above
回答2:
Sounds like you need a LinkedList object:
LinkedList Outer;
where ParentType is a class that has another LinkedList object of it own:
Public Class ParentType
Private myChildren As LinkedList<ChildType>
ChildType in above could even be replaced with "ParentType," if it's a list of the exact same kind of object.
For more detail on LinkedList: http://msdn.microsoft.com/en-us/library/6ky9a64s.aspx