tags:

views:

48

answers:

2

hi,

i want to crate a hierarchical data structure same as XML, means parent, child, sub child... like that one using vb.net. so ho can i create that one?

+2  A: 

You can use the XElement class to model an XML tree.

SLaks
i don't have to use XML, but by functionality wise i want to create it exactly like XML.
Then you might as well use XML, at least in-memory. You can easily use XElement to hold an in-memory tree without actually generating XML.
SLaks
No point in reinventing the wheel when you're trying to make the exact same wheel
msarchet
A: 

Here is the general pattern for creating parent-child relationships.

Public Class Node

  Private m_Children As List(Of Node) = New List(Of Node)

  Public ReadOnly Property Children() As List(Of Node)
    Get
      Return m_Children
    End Get
  End Property  

End Class
Brian Gideon