Performing Isolated Storage Tasks
Three main classes are provided to help you perform tasks that involve isolated storage:
- IsolatedStorageFile, which derives from IsolatedStorage, provides basic management of stored assembly and application files. An instance of the IsolatedStorageFile class represents a single store located in the file system.
- IsolatedStorageFileStream, which derives from System.IO.FileStream, provides access to the files in a store.
- IsolatedStorageScope is an enumeration that enables you to create and select a store with the appropriate isolation type.
The isolated storage classes enable you to create, enumerate, and delete isolated storage. The methods for performing these tasks are available through the IsolatedStorageFile object. Some operations require you to have the IsolatedStorageFilePermission that represents the right to administer isolated storage; you might also need to have operating system rights to access the file or directory. On Microsoft Windows NT and Microsoft Windows 2000, access control list (ACL) settings on the file can prevent you from accessing isolated storage. The Isolated Storage tool, Storeadm.exe, can also be used for simple store management such as listing or deleting all the stores for the current user.
In This Section
- Obtaining Stores
- Provides an example of using the IsolatedStorageFile class to obtain a store isolated by user and assembly.
- Enumerating Stores
- Demonstrates an application of the IsolatedStorageFile.GetEnumerator method by using it to calculate the size of all isolated storage for the user.
- Deleting Stores
- Demonstrates how the IsolatedStorageFile.Remove method can be used in two different ways to delete isolated stores.
- Anticipating Out of Space Conditions
- Shows how to measure the remaining space in an isolated store.
- Creating Files and Directories
- Provides some examples of creating files and directories in an isolated store.
- Finding Existing Files and Directories
- Demonstrates how to read the directory structure and files in isolated storage.
- Reading and Writing to Files
- Provides an example of writing a string to an IsolatedStorageFile and reading it back.
- Deleting Files and Directories
- Demonstrates how isolated storage files and directories are deleted.
Note Each of these examples has a source file that illustrates one specific task. Instructions for setting up, compiling, and running are included on the main page of each example. The examples are provided in C# only.