IsolatedStorageFile Class

IsolatedStorageFile Class

 

Represents an isolated storage area containing files and directories.

Namespace:   System.IO.IsolatedStorage
Assembly:  mscorlib (in mscorlib.dll)

System.Object
  System.MarshalByRefObject
    System.IO.IsolatedStorage.IsolatedStorage
      System.IO.IsolatedStorage.IsolatedStorageFile

[ComVisibleAttribute(true)]
public sealed class IsolatedStorageFile : IsolatedStorage, IDisposable

NameDescription
System_CAPS_pubpropertyApplicationIdentity

Gets an application identity that scopes isolated storage.(Inherited from IsolatedStorage.)

System_CAPS_pubpropertyAssemblyIdentity

Gets an assembly identity used to scope isolated storage.(Inherited from IsolatedStorage.)

System_CAPS_pubpropertyAvailableFreeSpace

Gets a value that represents the amount of free space available for isolated storage.(Overrides IsolatedStorage.AvailableFreeSpace.)

System_CAPS_pubpropertyCurrentSize

Obsolete.Gets the current size of the isolated storage.(Overrides IsolatedStorage.CurrentSize.)

System_CAPS_pubpropertyDomainIdentity

Gets a domain identity that scopes isolated storage.(Inherited from IsolatedStorage.)

System_CAPS_pubpropertySystem_CAPS_staticIsEnabled

Gets a value that indicates whether isolated storage is enabled.

System_CAPS_pubpropertyMaximumSize

Obsolete.Gets a value representing the maximum amount of space available for isolated storage within the limits established by the quota.(Overrides IsolatedStorage.MaximumSize.)

System_CAPS_pubpropertyQuota

Gets a value that represents the maximum amount of space available for isolated storage.(Overrides IsolatedStorage.Quota.)

System_CAPS_pubpropertyScope

Gets an IsolatedStorageScope enumeration value specifying the scope used to isolate the store.(Inherited from IsolatedStorage.)

System_CAPS_pubpropertyUsedSize

Gets a value that represents the amount of the space used for isolated storage.(Overrides IsolatedStorage.UsedSize.)

NameDescription
System_CAPS_pubmethodClose()

Closes a store previously opened with GetStore, GetUserStoreForAssembly, or GetUserStoreForDomain.

System_CAPS_pubmethodCopyFile(String, String)

Copies an existing file to a new file.

System_CAPS_pubmethodCopyFile(String, String, Boolean)

Copies an existing file to a new file, and optionally overwrites an existing file.

System_CAPS_pubmethodCreateDirectory(String)

Creates a directory in the isolated storage scope.

System_CAPS_pubmethodCreateFile(String)

Creates a file in the isolated store.

System_CAPS_pubmethodCreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodDeleteDirectory(String)

Deletes a directory in the isolated storage scope.

System_CAPS_pubmethodDeleteFile(String)

Deletes a file in the isolated storage scope.

System_CAPS_pubmethodDirectoryExists(String)

Determines whether the specified path refers to an existing directory in the isolated store.

System_CAPS_pubmethodDispose()

Releases all resources used by the IsolatedStorageFile.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodFileExists(String)

Determines whether the specified path refers to an existing file in the isolated store.

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Overrides Object.Finalize().)

System_CAPS_pubmethodGetCreationTime(String)

Returns the creation date and time of a specified file or directory.

System_CAPS_pubmethodGetDirectoryNames()

Enumerates the directories at the root of an isolated store.

System_CAPS_pubmethodGetDirectoryNames(String)

Enumerates the directories in an isolated storage scope that match a given search pattern.

System_CAPS_pubmethodSystem_CAPS_staticGetEnumerator(IsolatedStorageScope)

Gets the enumerator for the IsolatedStorageFile stores within an isolated storage scope.

System_CAPS_pubmethodGetFileNames()

Enumerates the file names at the root of an isolated store.

System_CAPS_pubmethodGetFileNames(String)

Gets the file names that match a search pattern.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetLastAccessTime(String)

Returns the date and time a specified file or directory was last accessed.

System_CAPS_pubmethodGetLastWriteTime(String)

Returns the date and time a specified file or directory was last written to.

System_CAPS_pubmethodGetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodSystem_CAPS_staticGetMachineStoreForApplication()

Obtains machine-scoped isolated storage corresponding to the calling code's application identity.

System_CAPS_pubmethodSystem_CAPS_staticGetMachineStoreForAssembly()

Obtains machine-scoped isolated storage corresponding to the calling code's assembly identity.

System_CAPS_pubmethodSystem_CAPS_staticGetMachineStoreForDomain()

Obtains machine-scoped isolated storage corresponding to the application domain identity and the assembly identity.

System_CAPS_pubmethodSystem_CAPS_staticGetStore(IsolatedStorageScope, Evidence, Type, Evidence, Type)

Obtains isolated storage corresponding to the given application domain and the assembly evidence objects and types.

System_CAPS_pubmethodSystem_CAPS_staticGetStore(IsolatedStorageScope, Object)

Obtains isolated storage corresponding to the given application identity.

System_CAPS_pubmethodSystem_CAPS_staticGetStore(IsolatedStorageScope, Object, Object)

Obtains the isolated storage corresponding to the given application domain and assembly evidence objects.

System_CAPS_pubmethodSystem_CAPS_staticGetStore(IsolatedStorageScope, Type)

Obtains isolated storage corresponding to the isolation scope and the application identity object.

System_CAPS_pubmethodSystem_CAPS_staticGetStore(IsolatedStorageScope, Type, Type)

Obtains isolated storage corresponding to the isolated storage scope given the application domain and assembly evidence types.

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticGetUserStoreForApplication()

Obtains user-scoped isolated storage corresponding to the calling code's application identity.

System_CAPS_pubmethodSystem_CAPS_staticGetUserStoreForAssembly()

Obtains user-scoped isolated storage corresponding to the calling code's assembly identity.

System_CAPS_pubmethodSystem_CAPS_staticGetUserStoreForDomain()

Obtains user-scoped isolated storage corresponding to the application domain identity and assembly identity.

System_CAPS_pubmethodSystem_CAPS_staticGetUserStoreForSite()

This API supports the product infrastructure and is not intended to be used directly from your code. Obtains a user-scoped isolated store for use by applications in a virtual host domain.

System_CAPS_pubmethodIncreaseQuotaTo(Int64)

Enables an application to explicitly request a larger quota size, in bytes. (Overrides IsolatedStorage.IncreaseQuotaTo(Int64).)

System_CAPS_pubmethodInitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodMoveDirectory(String, String)

Moves a specified directory and its contents to a new location.

System_CAPS_pubmethodMoveFile(String, String)

Moves a specified file to a new location, and optionally lets you specify a new file name.

System_CAPS_pubmethodOpenFile(String, FileMode)

Opens a file in the specified mode.

System_CAPS_pubmethodOpenFile(String, FileMode, FileAccess)

Opens a file in the specified mode with the specified read/write access.

System_CAPS_pubmethodOpenFile(String, FileMode, FileAccess, FileShare)

Opens a file in the specified mode, with the specified read/write access and sharing permission.

System_CAPS_pubmethodRemove()

Removes the isolated storage scope and all its contents.(Overrides IsolatedStorage.Remove().)

System_CAPS_pubmethodSystem_CAPS_staticRemove(IsolatedStorageScope)

Removes the specified isolated storage scope for all identities.

System_CAPS_pubmethodToString()

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.

This type implements the IDisposable interface. When you have finished using the type, you should dispose of it either directly or indirectly. To dispose of the type directly, call its Dispose method in a try/catch block. To dispose of it indirectly, use a language construct such as using (in C#) or Using (in Visual Basic). For more information, see the “Using an Object that Implements IDisposable” section in the IDisposable interface topic.

System_CAPS_importantImportant

Isolated storage is not available for Windows 8.x 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.");
        }
    }
}

.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft