我在linq to 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无法将方法组分配给隐式类型的局部变量
如何解决?
答案 0 :(得分:2)
你忘了实际调用Count方法,添加括号:
var after = (from c in db.Employees
where c.emp_city == "pune"
select c).Count();