To check whether a file is in use or not in .Net program

As the saying goes, Prevention is better than cure. It is always better to check whether file is in use before doing any file operation on it to avoid any unexpected IOException during the runtime. Exception in question is: System.IO.IOException: The process cannot access the file ‘C:\Inetpub\XXX.jpg’ because it is being used by another process.at…

0