问题描述
尝试删除隔离存储中的目录时出现异常。
访问IsolatedStorage时出错
IsolatedStorageFile storageFile = IsolatedStorageFile.GetUserStoreForApplication();
string directory = SaveListPicker.SelectedItem.ToString();
试试
{
if(storageFile.DirectoryExists(directory))
{
var imageslist = storageFile.GetFileNames(目录+" \\ *。*");
foreach(图片列表中的var项目)
{
storageFile.DeleteFile(目录+" \\" + item);
}
}
}
catch(例外e)
{
string exceptionresult = e.Message;
}
I am getting an exception when trying to delete directory in the isolated storage.
An error occurred while accessing IsolatedStorage
IsolatedStorageFile storageFile = IsolatedStorageFile.GetUserStoreForApplication();
string directory = SaveListPicker.SelectedItem.ToString();
try
{
if (storageFile.DirectoryExists(directory))
{
var imageslist = storageFile.GetFileNames(directory+"\\*.*") ;
foreach (var item in imageslist)
{
storageFile.DeleteFile(directory + "\\" + item);
}
}
}
catch (Exception e)
{
string exceptionresult = e.Message;
}
这篇关于隔离存储删除文件会创建异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!