更新时间:2022-04-26 07:52:40
的 @克雷格的回答是正确的。要解决,将其更改为:
@Craig's answer is correct. To resolve, change it to:
IEnumerable<T> MakeStuff()
编辑:至于为什么,看的的IEnumerable< T>接口>:
public interface IEnumerable<out T> : IEnumerable
注意的&IList的LT; T>接口>没有out关键字。方差支持在接口和委托,而不是类泛型类型参数,所以它并不适用于列出< T>
Note that the IList<T> Interface does not have the out keyword. Variance is supported for generic type parameters in interfaces and delegates, not classes, so it doesn't apply to List<T>.