blob: c03931b95958c58bd38f839e39ded4041feb6203 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
public class Z : IGenericInterface<Z>
{
public void Stop ()
{
}
Z IGenericInterface<Z>.Start ()
{
return this;
}
}
public interface IGenericInterface<T>
{
T Start ();
}
public class A<Y, Y2, W>
where Y : Z, IGenericInterface<Y>
where Y2 : class
where W : Y, Y2
{
public void SomeOperation (W w)
{
w.Start ();
w.Stop ();
}
public void SomeOtherOperation (Y y)
{
y.Start ();
y.Stop ();
}
}
public class Foo
{
public static int Main ()
{
var a = new A<Z, object, Z> ();
a.SomeOperation (new Z ());
a.SomeOtherOperation (new Z ());
return 0;
}
}
|