I've been writing code in VB and VBScript for several
years and I'm finally caving in to .net! I've decided to
work with C# as I've always understood the basic concepts
of C/C++ but never gained much experience in writing
actual code.
I'm trying to work out the best way to implement a class
to meet the following requirements.
I have three types of object, lets call them Object1,
Object2 and Object3. Each of these has their own unique
values (i.e. Object1.Name, Object2.Name,
Object3.Location) but there is also a set of
relationships where an Object1 can contain one or more
Object2's and each Object2 could contain one or more
Object3's. It's like a treeview hierarchy.
Basically, I want to work out the best way to implement
this in a manner that the relationships between the
objects would be easy to manange. I'd also like to be
able to iterate through all of the objects belonging to
another object. For example, for a particular instance
of Object2, I'd like to list each related Object3 -
something like foreach(Object3 someObject in myObject2).
I hope I've explained that well enough. In short, I need
to model some hierarchical data and I want to be able to
iterate through it quickly and easily.
Thanks in advance,
Mark.