为什么不会以下code的工作?
Why won't the following code work?
class parent {}
class kid:parent {}
List<parent> parents=new List<kid>;
这似乎是显而易见的我。这是怎么回事吗?
It seems obvious to me. What's going on here?
C#目前不支持协方差。
,这是未来在.NET 4.0,但是在接口和委托。
It's coming in .NET 4.0, however, on interfaces and delegates.
埃里克利珀有一个非常漂亮的的系列在他的博客这个主题的一段时间回来。 的Visual Studio杂志涵盖太在最近的文章。
Eric Lippert had a very nice series on this subject on his blog awhile back. Visual Studio Magazine covers it too in a recent article.