我有一个以下的表格层次结构:
class EditForm<T> : Form { }
class ConcreteForm : ConcreteFormDesignable { }
class ConcreteFormDesignable : EditForm<int> { }
class AdvEditForm<T> : EditForm<T> { } // <-- ???
class AdvConcreteForm : AdvConcreteFormDesignable { }
class AdvConcreteFormDesignable : AdvEditForm<int> { }
如何使AdvEditForm可设计?
编辑(对于Alex Aza):
我不清楚,我应该把它放在AdvEditForm.cs和AdvEditForm.Designer.cs中......
AdvEditForm.Designer.cs:
public partial class NonGenericAdvEditForm { }
AdvEditForm.cs:
public partial class NonGenericAdvEditForm : AdvEditForm<Object> { }
public class AdvEditForm<T> : EditForm<T> { }
但我不明白我应该从哪个类继承AdvConcreteForm:
class AdvConcreteForm : AdvConcreteFormDesignable { }
class AdvConcreteFormDesignable : ??????? { }
答案 0 :(得分:2)
您可以仅为Design
目的添加非泛型类。
class NonGenericAdvEditForm : AdvEditForm<ConcreteType>
{
}
设计师需要具体的课程,例如AdvEditForm<int>
或AdvEditForm<MyType>
。如果不指定T是什么,则无法实例化AdvEditForm<T>
。指定具体T的方法是创建一个具体的非泛型类。
答案 1 :(得分:1)
答案 2 :(得分:0)
我找到的唯一解决方案是:
// 1 Uncomment for design
//public partial class EntityListViewWithEditor<TEntity> : EntityListViewDesignable
// 2 Uncomment for compilation
public partial class EntityListViewWithEditor<TEntity> : EntityListView<TEntity>
where TEntity : XPBaseObject
{ }
// 1 Uncomment for design
//public class EntityListViewDesignable : EntityListView<XPBaseObject> { }