Resharper建议我将此变量作为本地变量,并写下"access to modified closure"。
if (filter != null)
{
if (filter.CityId != 0)
{
ads = ads.Where(x => x.Ad.CityId == filter.CityId);
}
if (filter.BusinesCategoryId != 0)
{
ads = ads.Where(x => x.BusinessCategoryId == filter.BusinesCategoryId);
}
}
为什么要对局部变量进行过滤?
ads
? - Tigran