【发布时间】:2012-08-17 08:22:47
【问题描述】:
我的 C# 函数一次返回 100 个列表对象。我想填充一个列表,直到这个函数不返回任何列表。
我正在尝试做这样的事情:
int lastSelectedId = 0;
while(ReturnListOfCustomers(lastSelectedId).Count > 0)
{
List<Customers> newCustomers = ReturnListOfCustomers(lastSelectedId);
CustomerList.Append(newCustomers);
lastSelectedId = newCustomers.Last().rowid;
}
...但在这种情况下,我将不得不在每个循环中调用 ReturnListOfCustomers 函数两次,
我可以一次调用一个来让它变得更好吗?
谢谢。
【问题讨论】:
标签: c# function while-loop