Why isn't it possible to pass
Dictionary<string, PinkLady>()
into my Supply(Dictionary<string, IApple> apples)
method?
public interface IApple { }
public class PinkLady : IApple { }
public void Supply(Dictionary<string, IApple> apples) { }
public void TestMethod()
{
//Working
Supply(new Dictionary<string, IApple>());
//Not working
Supply(new Dictionary<string, PinkLady>());
}
I always get an error:
converting from Dictionary into Dictionary not possible. PinkLady does not match expected type IApple.