var q = from c in db.Customers where c.City == "London" select c
等价于SQL语句
select * from db.Customers c where c.City = "London"
然后把记录集赋给变量q
foreach (var v in q)
表示记录集q里的每一条记录v要执行下马{}里的操作
LINQ是将SQL语句倒写的。
你可以看成 select c from customers where c.city = 'London'
也就是查找客户表中城市名称为:London的客户。然后循环对这些客户做操作。