This is not a quiz, I would genuinely like some help here.
Can some explain to me why this compiles:
IEnumerable<int> ints = new int[0];
And this compiles:
IList<int[]> ints = new List<int[]>();
But this does not compile:
IList<IEnumerable<int>> ints = new List<int[]>();
And subsequently this does not compile:
public void Generic_List_Of_GenericType()
{
List<int[]> ints = new List<int[]>();
MyMethod( ints );
}
public void MyMethod(IEnumerable<IEnumerable<int>> test)
{
}
It is not clear to me why the compiler can figure out the first two cases but not the latter two.