我有以下foreach循环:
using System.IO;
//...
if (Directory.Exists(path))
{
foreach(string strFile in Directory.GetFiles(path, "*.txt"))
{
// do something, possibly delete the file named strFile
}
}
Run Code Online (Sandbox Code Playgroud)
删除当前用于foreach循环的目录中的文件时是否会有副作用?