a575963da9
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
47 lines
585 B
C#
47 lines
585 B
C#
|
|
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;
|
|
}
|
|
}
|