Xamarin

Windows Mobile Isolated Storage Beginners

By   Saturday, July 21, 2012 comments
reads
React:

WP7 Isolated Storage

●Isolated storage is used to store local text file a on Windows Phone 7

●If you know File concept in C#.net its easy for you

●If you have two applications that work with the same data. data you can't share. You can use web service/WCF for sharing data

●Windows Phone applications do not have an imposed quota size because the requirements for each application's scenario are different. So storage resources on a phone are limited so applications should only store necessary data. When a Windows Phone has only 10% of storage space remaining, user will receive notification.

●Isolated storage Action
➔Create File
➔Read File
➔Delete File
➔Create Folder
➔Delete Folder

Silverlight Windows Phone store following way

●Settings: Store data as key/value pairs by using the IsolatedStorageSettings class.

●Files and folders: Store files and folders by using the IsolatedStorageFile class.

●Relational data: Store relational data in a local database by using LINQ to SQL.


How to take Backup isolated Storage :

http://msdn.microsoft.com/en-us/library/hh286408(v=vs.92).aspx

Name Space:

using System.IO;
using System.IO.IsolatedStorage

Create Directory:

Code:

IsolatedStorageFile os = IsolatedStorageFile.GetUserStoreForApplication();
os.CreateDirectory(<dirname>); //
//List of Directory Name
foreach (object dir in os.GetDirectoryNames())
{
MessageBox.Show(dir.ToString());
}

Screen:





// Delete Directory
os.DeleteDirectory(txtdirname.Text);
//Check Directory is exists
if (os.DirectoryExists(txtdirname.Text) == true)
{
MessageBox.Show("Hi directory avl");
}
//Create File
IsolatedStorageFile os = IsolatedStorageFile.GetUserStoreForApplication();
StreamWriter osw=new StreamWriter(new
IsolatedStorageFileStream("js.txt",FileMode.CreateNew,os);
//create File and Save data
IsolatedStorageFile os = IsolatedStorageFile.GetUserStoreForApplication();
StreamWriter osw=new StreamWriter(new
IsolatedStorageFileStream("js1.txt",FileMode.Create,os));
osw.Write("hi welcome");
osw.Flush();
osw.Close();

//Replace File :

IsolatedStorageFile os = IsolatedStorageFile.GetUserStoreForApplication();
StreamWriter osw = new StreamWriter(os.OpenFile("js1.txt",
FileMode.Open,FileAccess.Write));
osw.Write("hi welcome");
osw.Flush();
osw.Close();

//Read Data:

IsolatedStorageFile os = IsolatedStorageFile.GetUserStoreForApplication();
StreamReader osr = new StreamReader(os.OpenFile("js1.txt", FileMode.Open,
FileAccess.Read));
txtdirname.Text = osr.ReadToEnd();
osr.Close();
SJ
Suthahar Jegatheesan

Senior Solutions Architect · Microsoft Azure, AI & Mobile. Author of the Xamarin Q&A Book.

More in this series

No comments:

sponsored

What Colleagues Say

“Suthahar is one of the most thorough and knowledgeable cloud architects I’ve worked with. His depth on Azure and ability to make complex mobile solutions work cross-platform is remarkable. He always delivers beyond expectations.”

AT Arun T. Senior Engineering Manager · Direct Manager

“I’ve followed Suthahar’s MSDEVBUILD blog for years — practical, deep, always current. Working alongside him confirmed what I suspected: he’s as sharp in person as on paper, and a genuinely generous mentor and architect.”

RK Rajesh K. Lead Developer · Mindtree

Certifications & Recognition

AZ-300 · Azure Architect Technologies AZ-301 · Azure Architect Design AZ-104 · Azure Administrator Associate AI-100 · Designing Azure AI Solutions DP-900 · Azure Data Fundamentals MCPD · Windows Phone Certified SAFe® 4 Scrum Master

Technical Expertise

☁ Cloud Platforms Microsoft Azure — Expert · 18 yrs App Services · AKS · Functions · Cosmos DB · APIM · Entra ID AWS & Google Cloud — Advanced
πŸ€– AI & Automation Azure OpenAI / GenAI — Advanced · 5 yrs RAG Pipelines · Bot Framework · Cognitive Services · Vision & Speech AI · ML.NET
πŸ“± Mobile Architecture .NET MAUI & Xamarin — Expert · 12 yrs Flutter · Native iOS/Android · Offline-First · Secure Storage & Auth
πŸ”’ Identity & Security Microsoft Entra ID — Expert OAuth 2.0 · OIDC · Zero Trust · Conditional Access · RBAC · Key Vault

Speaking & Community

Microsoft User Group Malaysia Recurring speaker on Azure architecture, AI integration and .NET mobile development across Malaysia and APAC.
Global Azure Bootcamp — Chennai Presented “AI into Xamarin Mobile Apps” at GAB Chennai, part of the worldwide Global Azure community event.
AI & Azure OpenAI Community Events Workshops and live demos on RAG pipelines, AI agents and intelligent workflow automation since 2023.
Mobile & Cloud Workshops — Coimbatore Multi-day deep-dive sessions at GRG Computer Technology, KG Microsoft Innovation Center and RVS College of Arts and Science.
500+Blog Articles
50+Conference Talks
10K+Monthly Readers
30Public Repositories
3Continents Delivered
MSDEVBUILD Assistant Ask about Suthahar, Azure, AI or mentorship
Hi! I’m a simple FAQ bot for MSDEVBUILD. Tap a question below or type your own.