数据表上的LINQ查询 - LINQ query on a DataTable

问题:

I'm trying to perform a LINQ query on a DataTable object and bizarrely I am finding that performing such queries on DataTables is not straightforward. 我试图对DataTable对象执行LINQ查询,但奇怪的是,我发现对DataTables执行此类查询并不简单。 For example: 例如: this

var results = from myRow in myDataTable
where results.Field("RowNo") == 1
select results;

This is not allowed. 这是不容许的。 How do I get something like this working? 如何得到相似的效果? spa

I'm amazed that LINQ queries are not allowed on DataTables! 我很惊讶在数据表上不容许使用LINQ查询! .net


解决方案:

参考一: https://stackoom.com/question/2p5/数据表上的LINQ查询
参考二: https://oldbug.net/q/2p5/LINQ-query-on-a-DataTable