Reputation:
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)?
Upvotes: 0
Views: 442
Reputation: 107606
private void DoWork()
{
ParseFolder("C:\\");
// Once you get here, the work is done.
}
private void ParseFolder(string strFolder)
{
foreach (string currentFolder in Directory.GetDirectories(strFolder))
ParseFolder(strFolder);
}
Upvotes: 1
Reputation: 422242
Yes, just add a method call after it:
ParseFolder("C:\\"); // You need to escape \
Notify();
Upvotes: 1