本文介绍了隔离存储删除文件会创建异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试删除隔离存储中的目录时出现异常。


访问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;
}

解决方案


这篇关于隔离存储删除文件会创建异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-09 21:15