What am I missing here, shouldn't the compiler be able to unambiguously infer the types here?
abstract class Entity {}
class Model<TEntity> where TEntity : Entity {}
class Helper<T> {}
class Test {
static void Method<TModel, TEntity>(Helper<TModel> param)
where TModel : Model<TEntity>
where TEntity : Entity
{
}
class Foo : Entity {}
public static void Main ()
{
Method(new Helper<Model<Foo>>());
}
}
I get the following error:
a.cs(20,3): error CS0411: The type arguments for method 'Test.Method(Helper)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
Specifying the types at the call-site works, but I'd rather not have to do that.