public interface IRandom {}
public class Random: IRandom {}
I can assign:
IRandom random = new Random();
but when I try this:
IList<IRandom> randomList = new List<Random>();
I get cannot convert List<Random> to target type IList<IRandom>
Can someone please explain why not?
Basically I was trying to have a list I could assign another list to which contain items that inherited from IRandom
.