考虑下面的代码:
public IEnumerable <Country> ListPopulation()
{
foreach(var continent in Continents)
{
var ids = context.continentTable
.where(y=>y.Name == continent.name)
.select(x=>x.countryId);
}
return GetPopulation(ids);// ids is not available here
}
Public IEnumerable<Country>GetPopulation(IQueryable<int> idnumbers)
{
}
我怎样才能初始化var ids
这样我可以用它来调用GetPopulation()
?