我有这些课程:
class Foo<T1, T2> : Form
where T1, T2 : EventArgs
class MiddleGoo : Foo<X,Y>
class Goo : MiddleGoo
Run Code Online (Sandbox Code Playgroud)
X,Y只是从EventArgs派生的简单类.
我在设计师中看到Goo,但我想在Foo和Goo之间创建一个类Boo,如下所示:
class Boo<T1, Y> : Foo<T1, Y>
where T1 : EventArgs
class MiddleGoo : Boo<X,Y>
class Goo : MiddleGoo
Run Code Online (Sandbox Code Playgroud)
中产阶级的解决方法不起作用,任何想法?
编辑:我的意思是Y和X是像YEventArgs和XEventArgs这样的类,我的问题是当我将Y定义为T2但仍希望通过T1保持通用时,在设计器类Boo中查看.
编辑2:我刚刚意识到我拼错了Y级的东西......
public class Foo<T1, T2> : Form
where T1 : EventArgs
where T2 : EventArgs
{
}
public class Boo<T1> : Foo<T1, MyEventArgs2>
where T1 : EventArgs
{
}
public class MiddleGoo : Boo<MyEventArgs1>
{
}
class Goo : …Run Code Online (Sandbox Code Playgroud)