I am getting this error every time I try to read a file after it is being created. To follow the process:
The file is created using
File.Create(filename);
I then attempt to read that file, using:
StreamReader rdr = new StreamReader(filename); //error catches here
I get the error:
The process cannot access the file '(filename)' because it is being used by another process.
Is this occurring because I haven't closed the file after creating it? How do I do that? Does File.Close(fileName);
work?