IsolatedStorageFile Class
Represents an isolated storage area containing files and directories.
System.MarshalByRefObject
System.IO.IsolatedStorage.IsolatedStorage
System.IO.IsolatedStorage.IsolatedStorageFile
Namespace: System.IO.IsolatedStorage
Assembly: mscorlib (in mscorlib.dll)
The IsolatedStorageFile type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | ApplicationIdentity | Gets an application identity that scopes isolated storage. (Inherited from IsolatedStorage.) |
![]() | AssemblyIdentity | Gets an assembly identity used to scope isolated storage. (Inherited from IsolatedStorage.) |
![]() | AvailableFreeSpace | Gets a value that represents the amount of free space available for isolated storage. (Overrides IsolatedStorage.AvailableFreeSpace.) |
![]() | CurrentSize | Obsolete. Gets the current size of the isolated storage. (Overrides IsolatedStorage.CurrentSize.) |
![]() | DomainIdentity | Gets a domain identity that scopes isolated storage. (Inherited from IsolatedStorage.) |
![]() ![]() | IsEnabled | Gets a value that indicates whether isolated storage is enabled. |
![]() | MaximumSize | Obsolete. Gets a value representing the maximum amount of space available for isolated storage within the limits established by the quota. (Overrides IsolatedStorage.MaximumSize.) |
![]() | Quota | Gets a value that represents the maximum amount of space available for isolated storage. (Overrides IsolatedStorage.Quota.) |
![]() | Scope | Gets an IsolatedStorageScope enumeration value specifying the scope used to isolate the store. (Inherited from IsolatedStorage.) |
![]() | UsedSize | Gets a value that represents the amount of the space used for isolated storage. (Overrides IsolatedStorage.UsedSize.) |
| Name | Description | |
|---|---|---|
![]() | Close | Closes a store previously opened with GetStore, GetUserStoreForAssembly, or GetUserStoreForDomain. |
![]() | CopyFile(String, String) | Copies an existing file to a new file. |
![]() | CopyFile(String, String, Boolean) | Copies an existing file to a new file, and optionally overwrites an existing file. |
![]() | CreateDirectory | Creates a directory in the isolated storage scope. |
![]() | CreateFile | Creates a file in the isolated store. |
![]() | CreateObjRef | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.) |
![]() | DeleteDirectory | Deletes a directory in the isolated storage scope. |
![]() | DeleteFile | Deletes a file in the isolated storage scope. |
![]() | DirectoryExists | Determines whether the specified path refers to an existing directory in the isolated store. |
![]() | Dispose | Releases all resources used by the IsolatedStorageFile. |
![]() | Equals(Object) | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | FileExists | Determines whether the specified path refers to an existing file in the isolated store. |
![]() | GetCreationTime | Returns the creation date and time of a specified file or directory. |
![]() | GetDirectoryNames() | Enumerates the directories at the root of an isolated store. |
![]() | GetDirectoryNames(String) | Enumerates the directories in an isolated storage scope that match a given search pattern. |
![]() ![]() | GetEnumerator | Gets the enumerator for the IsolatedStorageFile stores within an isolated storage scope. |
![]() | GetFileNames() | Enumerates the file names at the root of an isolated store. |
![]() | GetFileNames(String) | Gets the file names that match a search pattern. |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetLastAccessTime | Returns the date and time a specified file or directory was last accessed. |
![]() | GetLastWriteTime | Returns the date and time a specified file or directory was last written to. |
![]() | GetLifetimeService | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() ![]() | GetMachineStoreForApplication | Obtains machine-scoped isolated storage corresponding to the calling code's application identity. |
![]() ![]() | GetMachineStoreForAssembly | Obtains machine-scoped isolated storage corresponding to the calling code's assembly identity. |
![]() ![]() | GetMachineStoreForDomain | Obtains machine-scoped isolated storage corresponding to the application domain identity and the assembly identity. |
![]() ![]() | GetStore(IsolatedStorageScope, Object) | Obtains isolated storage corresponding to the given application identity. |
![]() ![]() | GetStore(IsolatedStorageScope, Type) | Obtains isolated storage corresponding to the isolation scope and the application identity object. |
![]() ![]() | GetStore(IsolatedStorageScope, Object, Object) | Obtains the isolated storage corresponding to the given application domain and assembly evidence objects. |
![]() ![]() | GetStore(IsolatedStorageScope, Type, Type) | Obtains isolated storage corresponding to the isolated storage scope given the application domain and assembly evidence types. |
![]() ![]() | GetStore(IsolatedStorageScope, Evidence, Type, Evidence, Type) | Obtains isolated storage corresponding to the given application domain and the assembly evidence objects and types. |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() ![]() | GetUserStoreForApplication | Obtains user-scoped isolated storage corresponding to the calling code's application identity. |
![]() ![]() | GetUserStoreForAssembly | Obtains user-scoped isolated storage corresponding to the calling code's assembly identity. |
![]() ![]() | GetUserStoreForDomain | Obtains user-scoped isolated storage corresponding to the application domain identity and assembly identity. |
![]() ![]() | GetUserStoreForSite | Infrastructure. Obtains a user-scoped isolated store for use by applications in a virtual host domain. |
![]() | IncreaseQuotaTo | Enables an application to explicitly request a larger quota size, in bytes. (Overrides IsolatedStorage.IncreaseQuotaTo(Int64).) |
![]() | InitializeLifetimeService | Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | MoveDirectory | Moves a specified directory and its contents to a new location. |
![]() | MoveFile | Moves a specified file to a new location, and optionally lets you specify a new file name. |
![]() | OpenFile(String, FileMode) | Opens a file in the specified mode. |
![]() | OpenFile(String, FileMode, FileAccess) | Opens a file in the specified mode with the specified read/write access. |
![]() | OpenFile(String, FileMode, FileAccess, FileShare) | Opens a file in the specified mode, with the specified read/write access and sharing permission. |
![]() | Remove() | Removes the isolated storage scope and all its contents. (Overrides IsolatedStorage.Remove().) |
![]() ![]() | Remove(IsolatedStorageScope) | Removes the specified isolated storage scope for all identities. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
This object corresponds to a specific isolated storage scope, where files represented by IsolatedStorageFileStream objects exist. Applications can use isolated storage to save data in their own isolated portion of the file system, without having to specify a particular path within the file system. Since isolated stores are scoped to particular assemblies, most other managed code will not be able to access your code's data (highly trusted managed code and administration tools can access stores from other assemblies). Unmanaged code can access any isolated stores.
For more information, see Isolated Storage.
Important |
|---|
Isolated storage is not available for Windows Store apps. Instead, use the application data classes in the Windows.Storage namespaces included in the Windows Runtime API to store local data and files. For more information, see Application data in the Windows Dev Center. |
The following code example illustrates how to create files and directories in an isolated store. First, a store that is isolated by user, domain, and assembly is retrieved and placed in the isoStore variable. The CreateDirectory method is then called to create directories, and two instances of the IsolatedStorageFileStream class create files in these directories.
using System; using System.IO; using System.IO.IsolatedStorage; public class CreatingFilesDirectories { public static void Main() { using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly, null, null)) { isoStore.CreateDirectory("TopLevelDirectory"); isoStore.CreateDirectory("TopLevelDirectory/SecondLevel"); isoStore.CreateDirectory("AnotherTopLevelDirectory/InsideDirectory"); Console.WriteLine("Created directories."); isoStore.CreateFile("InTheRoot.txt"); Console.WriteLine("Created a new file in the root."); isoStore.CreateFile("AnotherTopLevelDirectory/InsideDirectory/HereIAm.txt"); Console.WriteLine("Created a new file in the InsideDirectory."); } } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.



Important