c# - C#取算符

标签 c# .net linq

给出以下声明

int[] numbers = { 0, 1, 2, 3 };


我注意到.NET 4.6.1上的VS 2015允许以下内容采用前三个数字

IEnumerable<int> firstThree = System.Linq.Enumerable.Take(numbers, 3);


但是,它不允许以下情况

IEnumerable<int> firstThree = numbers.Take(3);


我是C#的新手,无法理解为什么无法将调用解析为扩展方法。

最佳答案

您是否错过添加

using System.Linq;

关于c# - C#取算符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38672993/

相关文章:

c# - Entity Framework 查询以包括实体集合的子实体

c# - OData 无法识别我的集合属性

c# - 是否可以使用 SqlParameters 获取 SqlCommand 的解析文本?

.NET:如何使用现有实例打开文件?

asp.net-mvc - VB.NET/ASP.NET With 和 New 关键字困惑

linq - 更正 LINQ to SharePoint 查询中的多选值

c# - 从数据集中填充 DataGridView

c# - 由于包 ZedGraph 不兼容,无法运行包 EmguCV

c# - 使用 System.Net.WebClient 读取页面内容时,有没有办法指定文化?

c# - 如何转换查找的 TElement;在。 Lookup<TKey, Derived> 到 ILookup<TKey, Base>?