LINQ扩展方法不适用于EnumerableRowCollection< TRow>. [英] LINQ extension methods not available for EnumerableRowCollection<TRow>

查看:42
本文介绍了LINQ扩展方法不适用于EnumerableRowCollection< TRow>.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码行:

var availableClients = (Controller.ListClientsForCurrentUser() as DataTable).AsEnumerable();

,我想利用LINQ的扩展方法( MSDN ),例如任何.但是这些方法是不可见的.到底是怎么回事?我只能看到方法的位置,选择和顺序.

and I want to take advantage of LINQ's extension methods (MSDN) like Any. But those methods are not visible. What is going on? I can only see Where, Select and order by methods.

推荐答案

您是否丢失了

using System.Linq;

有没有机会?一旦获得EnumerableRowCollection<TRow>,就可以了. (如果您忘记调用AsEnumerable,则主要问题是使用DataTable,但这在这里不是问题.)

by any chance? Once you've got an EnumerableRowCollection<TRow> it should be fine. (The main problem using a DataTable if if you forget to call AsEnumerable, but that isn't a problem here.)

这篇关于LINQ扩展方法不适用于EnumerableRowCollection&lt; TRow&gt;.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆