I have this Linq Query
public IQueryable listAll()
{
ModelQMDataContext db = new ModelQMDataContext();
IQueryable lTax = from t
in db.tax
select new {Tax = t.tax1, Increase = t.increase};
return lTax;
}
how can I know the number of elements of lTax?
Thanks.
Do you really need to return
IQueryable? ReturningIQueryablefrom your method doesn’t provide much functionality since you can’t access the members of an anonymous type without reflection. In this case I suggest that you create a concrete type in the query to be able to returnIQueryable<T>:and then you can do:
listAll().Count();