Covariance/Contravariance Conundrum when using generic interface constraints
问题 public interface IShape{} public class Rectangle : IShape{} public class Base{} public class Derived : Base{} public interface IFoo<out T, in U> where T : IShape where U : Base { T Convert(U myType); } public class MyFoo : IFoo<Rectangle, Derived> { public Rectangle Convert(Derived myType) { throw new NotImplementedException(); } } class Program { static void Main(string[] args) { IFoo<IShape, Base> hmm = new MyFoo(); } } Given the above code, the compiler is unable to determine how to assign