I try to use FileStream (using namespace System.IO) but I get an exception :
Attempt to access the method failed
Here is the code :
<
On WindowsPhone you must use IsolatedStorage - see this tutorial for example - http://3water.wordpress.com/2010/08/07/isolated-storage-on-wp7-ii/
Read:
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
using (var readStream = new IsolatedStorageFileStream(fileName, FileMode.Open, store))
using (var reader = new StreamReader(readStream))
{
return reader.ReadToEnd();
}
Write:
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
using (var writeStream = new IsolatedStorageFileStream(fileName, FileMode.Create, store))
using (var writer = new StreamWriter(writeStream))
{
writer.Write(content);
}