I tested this code and got that it doesn't compiles.
interface IE<T>
{
}
class A<T> : IE<T>
{
public static void F<TU>() where TU : IE<T>
{
}
static void Foo()
{
F<A<int>>();
}
}
It fails even if I add public static void F<TU>() where TU : A<int>, IE<T>
.
afaik it's valid according to C# specs. If I remove contraint where TU : IE<T>
but in this case it couldn't affect, because A<int>
is subtype of IE<T>
.
And it's also funny because resharper suggest to add IE<T>
interface to A
why this code isn't valid?