【发布时间】:2010-10-03 19:54:34
【问题描述】:
考虑下面的代码:
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()?
【问题讨论】: