title: How to get the count from IQueryable
body: <p>I am implementing paging in my GridView. From <a href="http://www.codedigest.com/Articles/ASPNET/153_Custom_Paging_for_GridView_using_LINQ.aspx">this</a> article, I need two methods:</p>
  
  <pre><code>public IQueryable BindEmployees(int startRowIndex, int maximumRows)
  {
      EmployeeInfoDataContext dbEmp = new EmployeeInfoDataContext();
      var query = from emp in dbEmp.Employees
                  join dept in dbEmp.Departments
                      on emp.DeptID equals dept.DeptID
                  select new
                  {
                      EmpID = emp.EmpID,
                      EmpName = emp.EmpName,
                      Age = emp.Age,
                      Address = emp.Address,
                      DeptName = dept.DepartmentName
                  };
  
      return query.Skip(startRowIndex).Take(maximumRows);
  } 
  </code></pre>
  
  <p>And</p>
  
  <pre><code>public int GetEmployeeCount()
  {
      // How can I not repeat the logic above to get the count?
  }
  </code></pre>
  
  <p>How can I get the value of the second method <code>GetEmployeeCount</code> from the first method <code>BindEmployees</code> ? I mean without repeating the logic (the query)?</p>