Hi all:
I was wondering if I want to keep track of the number of folders in a recursive method, how can I made it so the counter would not get reseted each time in the loop in below's code?
// how to keep track of the number of sourceFolder that has been processed?
public void recursiveMethod(SPFolder sourceFolder, SPFolder destinationFolder)
{
int totalNumberOfFiles = sourceFolder.SubFolders.Count;
foreach (SPFolder sourceSubFolder in sourceFolder.SubFolders)
{
if (true)
{
SPFolder destSubFolder = null;
if (true)
{
destSubFolder = doSomething();
}
else
{
destSubFolder = doSomethingElse();
}
}
recursiveMethod(sourceSubFolder, destSubFolder);
}
}
The goal here is to display something like "processing folder 15 / 100" to the user. I'm having trouble keeping the folder count without getting it resetted. Assumption: the folders themselves dont have a unique ID.
Thanks.