adding a collection to an arraylist collection
for instance, i have a people class and a people collection.
i would like to create a phone collection which consists of
phone class and phone collection and then attach this to the
people class object.
so, in effect, i can call each people item and have the phone collection
as a property where i can iterate through this phone collection.
how can i make this happen?
thanks in advance.
Re: adding a collection to an arraylist collection
Ideally you'd have a PhoneNumber type and a PhoneNumberCollection type. You would create PhoneNumber objects and add them to a PhoneNumberCollection object. You'd then also have a Person type and a PersonCollection type. The Person class would have a ReadOnly property of type PhoneNumberCollection named PhoneNumbers.
Please always specify your version. If you're using .NET 1.x then you'd derive the collection classes from CollectionBase. If you're using .NET 2.0 then you'd derive them from Collection(Of Person) and Collection(Of PhoneNumber).