删除隔离的存储文件

我知道这可能听起来非常苛刻,所以提前抱歉,但我正在学习,我花了近2个小时试图找出如何做到这一点,没有结果……

我想知道如何从windows phone 7中的独立存储中删除特定文件。

提前致谢!

只需调用IsolatedStorageFile.DeleteFile

例如:

 IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication(); storage.DeleteFile("backup.bak"); 

使用IsolatedStorageFile.DeleteFile

 using(var store = IsolatedStorageFile.GetUserStoreForApplication()) store.DeleteFile("path.txt"); 
 // you should add here try / catch blocks using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication()) { store.DeleteFile("Your file Name string"); } 

您可以在此处查看课程: MSDN IsolatedStorageFile Class

只是添加到现有答案:记住捕获IsolatedStorageException而不是您可能使用的IOException。