「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")
ただし、そのディレクトリは削除されませんでした。それを解決するためのアイデアはありますか?