类型或命名空间' IsolatedStorage'名称空间中不存在System.IO' (你错过了程序集或引用吗?)

时间:2014-04-03 18:26:13

标签: c# storage isolatedstorage

我遇到了隔离存储的问题,基本上我正在为Windows手机和Windows桌面制作应用程序,用于我在Windows手机中的隔离存储我正在使用以下内容;

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桌面是相同的,但显然它不是,是否有不同的方法来实现相同的东西?为了避免错误!

1 个答案:

答案 0 :(得分:3)

您可能正在为 Windows应用商店(Windows 8及更高版本)而不是普通的Win Forms应用做.NET应用。您需要使用Windows.Storage命名空间。

没有直接的System.IO.IsolatedStorage命名空间..

使用Windows.Storage.ApplicationData.Current.LocalData代替System.IO.IsolatedStorage.IsolatedStorageFile类。

相关问题