开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜