Why does this not compile?
public interface IConcrete { }
public class Concrete : IConcrete { }
public class Runner
{
public static void Main()
{
var myList = new List<Concrete>();
DoStuffWithInterfaceList(myList); // compiler doesn't allow this
}
public static void DoStuffWithInterfaceList(List<IConcrete> listOfInterfaces) { }
}
And what's the quickest way to get myList to the correct type?
EDIT I messed up the DoStuffWithInterfaceList example
See Question&Answers more detail:os