请告诉我为什么file.Delete(gpath)不起作用?
我将非常感谢你:)如果这个代码有任何错误,那么告诉那个错误.这个代码可能是错的所以请告诉我.
string gpath;
string path=@"c:\Users\Adam\Desktop\";
string name="file";
string f="";
int i=0;
string ext=".txt";
while(File.Exists(path + name + f + ext))
{
i++;
f = i.ToString();
}
gpath = path + name + f + ext;
button2.Enabled = true;
File.Create(gpath);
File.Delete(gpath);//why there is an Error??
Run Code Online (Sandbox Code Playgroud) c# ×1