Linq to sql linq到sql连接

Linq to sql linq到sql连接,linq-to-sql,Linq To Sql,我在linq到sql连接中使用了以下表达式 int before = db.Employees.Count(); var after = (from c in db.Employees where c.emp_city == "pune" select c).Count; Console.WriteLine("# of Customers= {0}, In pu

我在linq到sql连接中使用了以下表达式

       int before = db.Employees.Count();

        var after = (from c in db.Employees
                     where c.emp_city == "pune"
                     select c).Count;


        Console.WriteLine("# of Customers= {0}, In pune= {1}", before, after);


        Console.ReadLine();
它给出了以下错误:

错误1无法将方法组分配给隐式类型的局部变量


如何解决此问题?

如果忘记实际调用Count方法,请添加括号:

 var after = (from c in db.Employees
                 where c.emp_city == "pune"
                 select c).Count();