I’m tempted to say this problem is with my general architecture but either way it’s probably easier to show as an example than it would be to describe.
public class AppUserBase
{
}
public class AppUserAbc : AppUserBase
{
}
public class ManagerBase<T> where T : AppUserBase
{
protected AppUserCollection<T> _users = new AppUserCollection<T>();
}
public class ManagerAbc : ManagerBase<AppUserAbc>
{
}
public static class Program
{
public static void Main()
{
ManagerAbc x = new ManagerAbc();
DoSomething(x); //fails
}
public static void DoSomething<M,U>(ManagerBase<AppUserBase> manager) where M : ManagerBase<U> where U : AppUserBase
{
//do something!
}
}
I hope what I’m trying to do is easy to see and what I should be doing is even easier to explain to me :-).
It’s because you have two type parameters but only one is in the method signature, so it can’t infer both. The other is not needed. Change your method signature to: