Hi,
I have a problem Im hoping someone can help me with.
Ive
a control which extends the asp.net Calendar Control allowing me to
display lists of events on the calendar. Currently its datasource is a
Datatable.
I have several classes which represent different
types of events. The base Class is called CalendarEvent and is
exntended by MeetingEvent, ConferenceEvent, InterviewEvent etc.
I
have an interface ICalendarEvent which has one method, getDataTable,
which return a datatable in the right format for the Extended Calendar
control. My Event classes all implement this interface.
I want
to create a collection of objects which implement ICalendarEvent. This
List should be able to contain objects of type CalendarEvent,
MeetingEvent etc.
Is this possible?
Thanks,
Conor
Loading
ConorPosted May 2, 2008, 4:59 PM
AlanPosted May 2, 2008, 4:56 PM
If you're using .NET 2.0 or later, just use a List. This works in much the same way as an ArrayList except that all the elements must be of types which implement ICalendarEvent.
Here's a link to the online docs for the generic List class if you're not familiar with it:
http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx