开发者

Visual Studio 2008 Form Inheritance and Generics Failure to load

开发者 https://www.devze.com 2022-12-19 14:28 出处:网络
Given the following inheritance tree: I have a public class BaseForm : Form This is the base form for all WinForms in the project (or most) and contains some basic stuff.

Given the following inheritance tree:

I have a

public class BaseForm : Form

This is the base form for all WinForms in the project (or most) and contains some basic stuff.

Later in time, when Generics came, I created a

public abstract partial class GenericObjectListBase<T> : BaseForm

And finally, I specialized that one with a:

public partial class MySpecialList : GenericObjectListBase<MySpeciaType>

It all works, but designer doesn’t work in the last “MySpecialList”.

I’ve read this 开发者_如何学JAVAquestion and answer, but I’m not entirely sure how it applies to me, given that I’m trying to see a “non-generic” class (MySPecialList). In either case, the error I get is the same.

The designer could not be shown for this file because none of the classes within it can be designed… bla bla bla (check the other question to see the error).

Knowing that there’s some sort of “known limitation”, do you have a “known workaround”?


This is a known problem. The VS designer will not let you have an abstract class in the middle of the inheritance tree.

Unfortunate, but that's the way it is. The best option is to make GenericObjectListBase a concrete class.

0

精彩评论

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