Why does this implicit cast not result in compile-time error? : <p>Just trying to understand C#. Just considering the following simplified example.</p>

<pre><code>void Main()
{
    IList&lt;IAnimal&gt; animals = new List&lt;IAnimal&gt;
    {
        new Chicken(),
        new Cow(),
    };

    // Shouldn't this line result in a compile-time error?
    foreach (Chicken element in animals)
    {
    }
}

public interface IAnimal
{
}

public class Cow : IAnimal
{
}

public class Chicken : IAnimal
{
}
</code></pre>

<p>Although the first iteration succeeds, the second does not. Honestly I expected this to fail on compile time. Does anyone understand why it only fails at runtime?</p>
