ChristianBG

I have an item class which handles all the specifics of an item pulled from the database. Now this item can be many different types. Right now it is only good enough to handle one item at a time no matter what type it is.

My question is, is there a way i can add a collection to this class so that it treats each item as an item in a collection like the combobox does with each members in its drop down window




Re: Windows Forms Data Controls and Databinding Creating Collections in Class

CommonGenius.com

Can you be more specific about what you are trying to accomplish What do you mean by "add a collection to this class" Do you mean you want your class to be a collection You can achieve that by inheriting from one of the collection classes (ArrayList, Hashtable, List<>, Dictionary<>, Collection<>, etc), or by implementing a collection interface (ICollection, IList, IDictionary, or their generic versions).




Re: Windows Forms Data Controls and Databinding Creating Collections in Class

ChristianBG

Thats exactly what i mean.

Myclass.item now from the way i see it can only handle one item at time. So i want to put each item it collects into an array or collection, this way each collection.item can hold all the properties of the myclass.item.

I think i confussed it even more, but you see where i am try to go. I am going to try to inherit from the collections generic now. I am new to writing complex class so i am not sure exactly how to lay things out.