Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LINQ extension methods not available for EnumerableRowCollection<TRow>

Tags:

.net

linq

I have a following line of code:

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

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.

like image 650
dragonfly Avatar asked Oct 17 '11 09:10

dragonfly


1 Answers

Are you missing

using System.Linq;

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.)

like image 83
Jon Skeet Avatar answered Sep 29 '22 01:09

Jon Skeet