tags:

views:

42

answers:

1

I have an AspTable with a small number of rows. I want to run a linq Where() on the collection to find one and remove it.

mytable.Rows is of type TableRowCollection mytable.Rows.AsQueryable() says it returns a Linq.Queryable but intellisense on this does not give me my Linq operators.

+3  A: 

You should be able to use:

myTable.Rows.Cast<TableRow>()

The problem is that TableRowCollection implements IEnumerable, but not IEnumerable<T> - and it's the latter that LINQ to Objects works with, primarily. The above will create an IEnumerable<TableRow> which will basically cast each item in turn.

Jon Skeet