public bool DeleteFile(string fileName, string path) { if (String.IsNullOrEmpty(fileName)) { throw new ArgumentNullException(nameof(fileName)); } if (String.IsNullOrEmpty(path)) { throw new ArgumentNullException(nameof(path)); } if (!path.EndsWith("\\")) { path = path + "\\"; } var fullPath = path + fileName; if (_fileSystem.FileExists(fullPath)) { try { _fileSystem.DeleteFile(fullPath); } catch (Exception) { return(false); } return(true); } return(false); }
public void DeleteFile(string path) { _fileSystem.DeleteFile(path); }