C# - 结束/完成“事件”递归函数?
让我们假设以下函数:
private void ParseFolder(string strFolder)
{
foreach (string currentFolder in Directory.GetDirectories(strFolder))
ParseFolder(strFolder);
}
现在我们开始递归循环:
ParseFolder("C:\");
当这个递归循环结束时(=所有目录都已解析),是否有办法得到通知?
Lets assume the following function:
private void ParseFolder(string strFolder)
{
foreach (string currentFolder in Directory.GetDirectories(strFolder))
ParseFolder(strFolder);
}
Now we start our recursive loop with:
ParseFolder("C:\");
Is there a way to be notified when this recusrive loop ends (= all directories have been parsed)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,只需在其后面添加一个方法调用即可:
Yes, just add a method call after it: