It's understood that using a polymorphic set of subclasses is, in most cases, preferable to using enum
and switch
. The part I'm having trouble with is populating a ListBox
or ComboBox
with the available types. Binding a listbox to an enum is relatively straight-forward, but how do you do the same thing while avoiding enums altogether?
More specifically, if I have
class MyBase
class A : MyBase
class B : MyBase
class C : MyBase
How do I make present a listbox on the UI that contains a textual description of each class... something like
This is Class A
This is Class B
This is Class C
and have an instance of class B
created after the user selects the 2nd item in the list?
Thanks