I have this method that counts files in a specific folder:
private void countfiles(string path)
{
if (path != "")
{
DirectoryInfo dir = new DirectoryInfo(path);
foreach (FileInfo filesindires in dir.GetFiles())
{
if (filesindires.FullName != Application.ExecutablePath)
{
num_files++;
Thread.Sleep(1);
}
}
foreach (DirectoryInfo dirsinfolder in dir.GetDirectories())
{
countfiles(dirsinfolder.FullName);
}
}
}
and when the user clicks the counter button, I need to create a thread, so the program does not hang.
Thread count = new Thread(new ThreadStart(countfiles(@"E:/test")));
But I get this error even before debugging:
Method Name Expected
I do not understand; What is this error required of me?
Finally, thanks for your help in advance.
source
share