I want to create and open a file, but only if it does not exist. I do not want to use File.Exists, because the stream through the switch after creating the file with the same name.
How to check if a System.IO.IOException was raised by an existing file? I prefer not to parse the msg error (even if it can be as simple as .indexOf ("exists"))
How can I do it?
user34537
source
share