linq to sql queries are only executed when you foreach the results. as a
datareader is used the row count is not known until all rows are read.
so the easiest is convert the query to an array. you then have both the
data and the row count (array size) at that point.
if you just need a row count, then don't use linq, as it has to read all
the rows and count them. add a method to the context that uses a
sqlcommand and count(*) to get the rowcount. sqlserver in this case will
do the count much faster.
note- in linq to sql, every time you foreach the query, its run again
-- bruce (sqlwork.com)