The file is being used by another process, I must close it? How?
问题 I am using a text file to have some data there for later purposes. So what I do is to check if file exists, if not I am creating a new file when I need. This gives me error saying that my file is still being used by a different process, but I'm not sure why that is. This is how I do it. Here, I am checking if file exists which starts when program runs: private void CreateLastOpenFile() { if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } if (!File.Exists(file)) { File