Why does type inference not work in the following case when I call DoSomething
?
public class A { }
public class B<T> { }
public static class Extensions
{
public static void DoSomething<TWrapper, TInner>(this TWrapper thing)
where TWrapper : B<TInner>
{
}
public static void Test()
{
new B<A>().DoSomething();
}
}
It seems to me that in the Test
method TWrapper
has to be B<A>
, so TInner
has to be A
. Why can't the compiler figure this out?