Probably I need a design pattern here: I have a factory that produces instances by the type. I want the user to be able to choose the type, so I need a caption for the type, then a list of the the common ancestor of the types.
Now, I'd like to enumerate the list, and print the captions. (No can do that, the static caption properties are inaccessible from the ancestor)
Then, I'd like to print the caption of an instance. Unable to do that, since the class properties are inaccessible from an instance.
If I use a dictionary, that connects the type and the caption, captions are again, inaccessible from the instance, nor the type, etc.
I've been using Delphi for 20 years, and used virtual constructors and virtual class properties every day. I kind of like C#, but after years, I still don't have comfy solution for such things. (Thanks for the help in advance)
Using System.Reflection
you can enumerate all types of an assembly, check if they derive from a given base type or implement a certain interface.
You can also access non public fields or properties (static or instance).
So may be this is the way to go.
If the class hierarchy is you own code, you also could/should simply redesign it a little to get access to the members that are now restricted..