好的,我已经四处寻找答案,但是找不到。我有一个返回值为的方法。
请提供更多上下文以便更准确地翻译。
IEnumerable<ICar>
并且调用的方法将方法的结果存储在
List<ICar>
但是我遇到了以下错误。
System.Collections.Generic.IEnumerable<Test.Interfaces.ICar> to
System.Collections.Generic.List<Test.Interfaces.ICar>. An explicit conversion exists
(are you missing a cast?)
我在MSDN上查看了
IEnumerable<T> interface and List<T> class.
以下内容来自于msdn。
public class List<T> : IList<T>, ICollection<T>, IEnumerable<T>, IList, ICollection,
IEnumerable
我就是不明白为什么我不能分配
IEnumerable<ICar> to List<ICar>.
有人可以给我解释一下吗?我错过了什么。