我创建了一个名为“MyFolder”的目录并在那里写了一些文本文件。现在,我想删除该目录,我正在使用以下代码:
public void DeleteDirectory(string directoryName)
{
try
{
using (IsolatedStorageFile currentIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
if (!string.IsNullOrEmpty(directoryName) && currentIsolatedStorage.DirectoryExists(directoryName))
{
currentIsolatedStorage.DeleteDirectory(directoryName);
textBox1.Text = "deleted";
}
}
}
catch (Exception ex)
{
// do something with exception
}
}
我试过了
DeleteDirectory("MyFolder")
DeleteDirectory("IsolatedStore\\MyFolder")
但是它没有删除该目录。有什么办法解决这个问题吗?