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

StackOverflow https://stackoverflow.com/questions/22845916

  •  27-06-2023
  •  | 
  •  

Question

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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top