簡體   English   中英

刪除隔離的存儲文件

[英]Delete an isolated storage file

我知道這可能聽起來非常苛刻,所以提前抱歉,但我正在學習,我花了近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。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM