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)
Sure :)
internal static bool FileOrDirectoryExists(string name) { return (Directory.Exists(name) || File.Exists(name)); }
1.4m articles
1.4m replys
5 comments
57.0k users