Conor

Conor

  • NA
  • 3
  • 0

Collection of objects of multiple types which implement an interface.

May 2 2008 4:24 PM
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

Answers (2)