I find myself doing this a lot just to ensure the filename is not in use. Is there a better way?
Directory.Exists(name) || File.Exists(name)
Another way to check if file exist.
FileInfo file = new FileInfo("file.txt"); if (file.Exists) { // TO DO }