C# 如何从独立存储中删除文件
我正在尝试从独立存储中删除文件。但它会向我返回错误消息。我不知道我哪里做错了C# 如何从独立存储中删除文件,c#,windows-phone-7,isolatedstorage,C#,Windows Phone 7,Isolatedstorage,我正在尝试从独立存储中删除文件。但它会向我返回错误消息。我不知道我哪里做错了 public void Delete(string folder, string fileName) { try { string path = folder + "\\" + fileName + ".txt"; string delPath = folder + "/" + fileName + ".txt";
public void Delete(string folder, string fileName)
{
try
{
string path = folder + "\\" + fileName + ".txt";
string delPath = folder + "/" + fileName + ".txt";
MessageBox.Show(delPath);
if (myIsolatedStorage.DirectoryExists(folder))
{
if (myIsolatedStorage.FileExists(delPath))
{
myIsolatedStorage.DeleteFile(delPath);
MessageBox.Show("File is Deleted..!!");
}
else
MessageBox.Show("There is no file is exists");
}
else
{
MessageBox.Show("There is no Folder is exists");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
请告诉我哪里出了错。
提前谢谢
错误消息:-
也许,您试图删除的文件仍在使用中。您的应用程序应该没有打开的文件或对您试图删除的文件的引用 尝试在文件夹之前添加
/
您将获得的错误消息或异常信息我全部!!这里我附上了一张截图。。请参考此..Hi@Ku6opr。。我试过你的建议。。到目前为止,同样的错误仍在发生。您在哪一行代码中出错?我成功删除了你的代码和文件。