Cannot access file because it's being used by another process
I am getting the following error when I try to run my program:
System.IO.IOException: 'The process cannot access the file because it is being used by another process.'
System.IO.IOException: 'The process cannot access the file because it is being used by another process.'
I googled around and most suggestions want you to close the file stream when you are done with a file however the files that I am triyng to rename don't have a close method.
So when I run this on a directory, it works on the first and sometimes the second file until something gets in the way. So what I need to do is force my program to rename files.