Chapter 17. Understanding Isolated Storage

Each program that is installed on a Windows Phone 7 device has its own area of storage in the phone's memory that can be used to store files and settings. This storage area is called isolated storage and cannot be accessed by any other program running on the phone. Each program has access only to the files and settings in its own isolated storage, and cannot access files and settings from other programs or the operating system. If your program needs to store any type of data on the user's phone, you will use isolated storage.

UNDERSTANDING ISOLATED STORAGE

As you can see, there are two areas within isolated storage, one that holds settings for the applications and one that holds files and folders saved to isolated storage. Figure 17-1 represents a typical folder structure for isolated storage.

FIGURE 17-1

Figure 17-1. FIGURE 17-1

WORKING WITH ISOLATED STORAGE

The System.IO.IsolatedStorage namespace has four classes that you will use when accessing your files and settings. They are as follows:

  • IsolatedStorage.IsolatedStorageFile represents an isolated storage area containing files and directories.

  • IsolatedStorage.IsolatedStorageSettings provides a dictionary object that stores key/value pairs in isolated storage.

  • IsolatedStorage.IsolatedFileStream exposes a file within isolated storage.

  • IsolatedStorage.IsolatedStorageException is the exception that is thrown when ...

Get Windows® Phone 7 Application Development 24-Hour Trainer now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.