我遇到了独立存储的问题,基本上我正在为 Windows Phone 和 Windows 桌面制作一个应用程序,用于 Windows Phone 中的独立存储,我正在使用以下内容;
System.IO.IsolatedStorage.IsolatedStorageFile userStore = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication();
using (var isoFileStream = new System.IO.IsolatedStorage.IsolatedStorageFileStream("students.txt", System.IO.FileMode.Open, userStore))
{
using (var isoFileReader = new System.IO.StreamReader(isoFileStream))
{
}
}
我以为 Windows 桌面是一样的,但显然不是,有没有不同的方法来实现同样的事情?以避免错误!
最佳答案
您可能正在为 Windows 应用商店(Windows 8 及更高版本)开发 .NET 应用程序,而不是普通的 Win Forms 应用程序。您需要使用 Windows.Storage
命名空间。
没有直接的 System.IO.IsolatedStorage 命名空间..
使用Windows.Storage.ApplicationData.Current.LocalData
而不是System.IO.IsolatedStorage.IsolatedStorageFile
类。
关于c# - 类型或命名空间 'IsolatedStorage' 不存在于命名空间 'System.IO' 中(是否缺少程序集或引用?),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22845916/