繁体   English   中英

类型或名称空间“ IsolatedStorage”在名称空间“ System.IO”中不存在(您是否缺少程序集或引用?)

[英]The type or namespace 'IsolatedStorage' does not exist in the namespace 'System.IO' (are you missing an assembly or reference?)

我遇到了隔离存储的问题,基本上,我正在为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 Store (Windows 8及更高版本)使用.NET应用程序,而不是普通的Win Forms应用程序。 您需要使用Windows.Storage命名空间。

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM