In my application I’m trying to rename the folder, but if the folder is opened in Windows Explorer I get an IOException. How can I identify whether folder is opened in Windows Explorer in C#?
In my application I’m trying to rename the folder, but if the folder is
Share
catch the IOException?
As others have said, just try to do what you want, catch the exception if it happens and take appropriate action, whatever that is in your context.
You don’t really have much choice as I see it, consider:
what happens if between CheckAccess succeeding and calling RenameFolder something else locks the folder? Whatcha gonna do then?