我正在寻找IEnumerable接口的Skip方法。
IList公共IEnumerable
接口,所以我认为我能够访问该方法。
无论如何,以下代码无法在 Mono 上编译:
private static void SkipFirst(IList<float> list)
{
IList<float> skippedFirst = list.Skip(1);
}
这是错误:
错误 CS1061:类型
System.Collections.Generic.IList<float>' does not contain a definition for
Skip' 并且找不到扩展方法Skip' of type
System.Collections.Generic.IList'(您是否缺少 using 指令或程序集引用?)
我究竟做错了什么?如何从IList
接口访问该方法?