I'm starting with linqToSql and I still have some problems making my queries.
For example, I want to retrieve in the same query two values, a subset of elements, and an integer with the count of the elements. This is how I did it separately:
int totalElements;
IEnumerable<ClsTax> result;
result = (from t in db.tax
select new ClsTax { Tax = t.tax1, Increase = t.increase }).Take(25);
totalElements = (from t in db.tax
select new ClsTax { Tax = t.tax1, Increase = t.increase }).Count();
As you can see, I can't use result.count() because I used Take(25) to obtain only the firsts 25 elements, and I want to know how many elements are in the database.
Are there any way to obtain both values using only one linq query?
Thanks!