C #: side effects with Directory.GetFiles in foreach statement and deleting files?
I have the following foreach loop:
using System.IO;
//...
if (Directory.Exists(path))
{
foreach(string strFile in Directory.GetFiles(path, "*.txt"))
{
// do something, possibly delete the file named strFile
}
}
Could there be side effects when deleting files in the directory currently being used for the foreach loop?
+1
source to share
2 answers