Usercontrol with Property List<Class> where class is abstract
I wrote a UserControl which is derived from a standard Control.
This UserControl has a Property which is a list of a abstract class. But i get an Error of the PropertyGrid which say that it could not create a new instance of the abstract class because it's abstract.
What can i do to handle th开发者_运维百科is?
Abstract classes cannot be created, they must be implemented.
An abstract class is a class that cannot be instantiated, but must be inherited from
This is why you see an error from the PropertyGrid.
You will need to create a base class that implements all or some of your abstract class or you might be able to use an interface.
Abstact VS Interface.
精彩评论