Programming - Silverlight - Isolated Storage
Isolated Storage provides a sandbox storage mechanism whch
emulates a normal filestore. It can be very useful in
restricted environments such as
Silverlight where we do not want to give full access to
the filesytem.
and
Here are some very quick examples on Isolated Storage
and
To WRITE some data to the Isolated Storage:
and
using (IsolatedStorageFile isoFile
= IsolatedStorageFile.GetUserStoreForApplication())
{
and using (IsolatedStorageFileStream
isoStream =
and new IsolatedStorageFileStream(m_fileName,
FileMode.Create, isoFile))
and {
and using (StreamWriter sw = new StreamWriter(isoStream))
and {
and
sw.Write(SerializeElements());
and }
and }
}
and
To READ some data from the
Isolated Storage.
using (IsolatedStorageFile isoFile
= IsolatedStorageFile.GetUserStoreForApplication())
{
and using (IsolatedStorageFileStream
isoStream =
and new IsolatedStorageFileStream(m_fileName,
FileMode.OpenOrCreate, isoFile))
and {
and using (StreamReader sr = new StreamReader(isoStream))
and {
and
data = sr.ReadToEnd();
and }
and }
}