Check if a file/directory exists: is there a better way?

前端 未结 8 1944
情歌与酒
情歌与酒 2020-12-09 07:41

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)
8条回答
提交回复
热议问题