I have a Base Class, called primitive Graphics. derived from this class are several different types of graphics, squares, rectangles, lines, etc.
I am storing those graphics in an object that inherits collectionbase. This causes a problem because I cannot access any of the members in the derived class when they are added to the collection. Here is the default property for my primitivecollection class
Public Class PrimitiveCollection
Inherits CollectionBase
''' <summary>
''' Get or set a primitive object by index
''' </summary>
Default Public Property Item(ByVal index As Integer) As Primitive
Get
Return DirectCast(List(index), Primitive)
End Get
Set(ByVal value As Primitive)
List(index) = value
End Set
End Property
My current workaround is to just put all of the public members in the base class, however this is starting to look ugly as I add more derived classes that need members available to the derived class only