Possible Duplicate:
C#: Is there a way to check if a file is in use?
I'm using the System.IO.File class to delete a file, but of course this causes an exception if it's being used. I don't just want to catch the exception and forget about it (that would be using an exception as a flow construct); I'd like to know how to check whether my file is being used by another process. What am I looking for?