stillinlife101
Programmer
I get the error: "The process cannot access the file 'cust.001' because it is being used by another process." When I run the following code:
However, the files will delete just fine with this code:
Why would declaring a variable array make a difference?
Dan
Code:
DirectoryInfo di = new DirectoryInfo(Path + "\\customers\\");
FileInfo[] fi = di.GetFiles("cust.*");
int[] b;
foreach (FileInfo f in fi)
f.Delete();
However, the files will delete just fine with this code:
Code:
DirectoryInfo di = new DirectoryInfo(Path + "\\customers\\");
FileInfo[] fi = di.GetFiles("cust.*");
//int[] b;
foreach (FileInfo f in fi)
f.Delete();
Why would declaring a variable array make a difference?
Dan