C# 删除隔离存储文件

C# 删除隔离存储文件,c#,silverlight,windows-phone-7,C#,Silverlight,Windows Phone 7,我知道这听起来可能非常愚蠢,所以事先很抱歉,但我正在学习,我花了近2个小时试图找出如何做到这一点,现在没有结果 我想知道如何从WindowsPhone7中的独立存储中删除特定文件 提前谢谢 只需打电话 例如: IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication(); storage.DeleteFile("backup.bak"); 使用 只是为了补充现有的答案:记住捕获IOException

我知道这听起来可能非常愚蠢,所以事先很抱歉,但我正在学习,我花了近2个小时试图找出如何做到这一点,现在没有结果

我想知道如何从WindowsPhone7中的独立存储中删除特定文件

提前谢谢

只需打电话

例如:

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


只是为了补充现有的答案:记住捕获IOException,而不是您可能习惯的IOException

// you should add here try / catch blocks

using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
{
store.DeleteFile("Your file Name string");
}
您可以在此处查看课程:

谢谢,我尝试了它,但是它抛出了异常:System.ArgumentException“发生在mscorlib.dll System.IO.IsolatedStorage.IsolatedStorage Exception中。需要记住的一点是,WP7模拟器在关闭时抛出了隔离存储。因此,如果您已经创建了该文件,请关闭模拟器并在下次运行时尝试删除,您将捕获一个异常。
// you should add here try / catch blocks

using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
{
store.DeleteFile("Your file Name string");
}