In a project of mine I'm currently doing this:
addTemplateToList(New docNULL)
addTemplateToList(New docAgenda)
addTemplateToList(New docAgendaNew)
addTemplateToList(New docOffer)
:
20 more
:
addTemplateToList(New docRequest)
all classes inherit docMain and addTemplateToList( X ) adds x to a List(Of docMain).
Now my question is: Is there a better way to do what's done in the code sample?
I thought of something like:
for all x as docMain in ALLAVAILABLECLASSES
if x.className().beginswith("doc") then addTemplateToList(x)
next
Is this somehow possible in VB.net (Reflection?)?