Reputation: 193
I have hit a problem with isolated storage, basically I am making an app for both windows phone and windows desktop for my isolated storage in windows phone I'm using the following;
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))
{
}
}
and I assumed it would be the same for windows desktop but apparently it's not, is there a different way to achieve the same thing? To avoid the error!
Upvotes: 2
Views: 2032
Reputation: 9499
You might be doing a .NET app for Windows Store (Windows 8 and above) and not a normal Win Forms App. You need to use the Windows.Storage
namespace.
There is no direct System.IO.IsolatedStorage namespace..
use Windows.Storage.ApplicationData.Current.LocalData
instead of System.IO.IsolatedStorage.IsolatedStorageFile
class.
Upvotes: 3