System.IO.IsolatedStorage.IsolatedStorageFile Class

Assembly: Mscorlib.dll
Namespace: System.IO.IsolatedStorage
Summary
Represents an isolated storage area containing files and directories.
C# Syntax:
public sealed class IsolatedStorageFile : IsolatedStorage, IDisposable
Remarks
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.
See also:
System.IO.IsolatedStorage Namespace

System.IO.IsolatedStorage.IsolatedStorageFile Member List:

Public Properties
AssemblyIdentity
(inherited from System.IO.IsolatedStorage.IsolatedStorage)
Read-only

See base class member description: System.IO.IsolatedStorage.IsolatedStorage.AssemblyIdentity


Gets an assembly identity used to scope isolated storage.
CurrentSize Read-only

Overridden:
Gets the current size of the isolated storage.
DomainIdentity
(inherited from System.IO.IsolatedStorage.IsolatedStorage)
Read-only

See base class member description: System.IO.IsolatedStorage.IsolatedStorage.DomainIdentity


Gets a domain identity that scopes isolated storage.
MaximumSize Read-only

Overridden:
Gets a value representing the maximum amount of space available for isolated storage within the limits established by the quota.
Scope
(inherited from System.IO.IsolatedStorage.IsolatedStorage)
Read-only

See base class member description: System.IO.IsolatedStorage.IsolatedStorage.Scope


Gets an IsolatedStorageScope enumeration value specifying the scope used to isolate the store.
Public Methods
Close Closes a store previously opened with IsolatedStorageFile.GetStore, IsolatedStorageFile.GetUserStoreForAssembly, or IsolatedStorageFile.GetUserStoreForDomain.
CreateDirectory Creates a directory in the isolated storage scope.
CreateObjRef
(inherited from System.MarshalByRefObject)
See base class member description: System.MarshalByRefObject.CreateObjRef


Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
DeleteDirectory Deletes a directory in the isolated storage scope.
DeleteFile Deletes a file in the isolated storage scope.
Dispose Closes a store previously opened with IsolatedStorageFile.GetStore, IsolatedStorageFile.GetUserStoreForAssembly, or IsolatedStorageFile.GetUserStoreForDomain.
Equals
(inherited from System.Object)
See base class member description: System.Object.Equals

Derived from System.Object, the primary base class for all objects.
GetDirectoryNames Enumerates directories in an isolated storage scope that match a given pattern.
GetEnumerator Gets the enumerator for the IsolatedStorageFile stores within an isolated storage scope.
GetFileNames Enumerates files in isolated storage scope that match a given pattern.
GetHashCode
(inherited from System.Object)
See base class member description: System.Object.GetHashCode

Derived from System.Object, the primary base class for all objects.
GetLifetimeService
(inherited from System.MarshalByRefObject)
See base class member description: System.MarshalByRefObject.GetLifetimeService


Retrieves the current lifetime service object that controls the lifetime policy for this instance.
GetStore Overloaded:
GetStore(IsolatedStorageScope scope, object domainIdentity, object assemblyIdentity)

Obtains the isolated storage corresponding to the given application domain and assembly evidence objects.
GetStore Overloaded:
GetStore(IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType)

Obtains isolated storage corresponding to the isolated storage scope given the application domain and assembly evidence types.
GetStore Overloaded:
GetStore(IsolatedStorageScope scope, Evidence domainEvidence, Type domainEvidenceType, Evidence assemblyEvidence, Type assemblyEvidenceType)

Obtains isolated storage corresponding to the given application domain and the assembly evidence objects and types.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
GetUserStoreForAssembly Obtains isolated storage corresponding to the calling code's assembly identity.
GetUserStoreForDomain Obtains isolated storage corresponding to the application domain identity and assembly identity.
InitializeLifetimeService
(inherited from System.MarshalByRefObject)
See base class member description: System.MarshalByRefObject.InitializeLifetimeService


Obtains a lifetime service object to control the lifetime policy for this instance.
Remove Overloaded:
Remove()

Overridden:
Removes the isolated storage scope and all its contents.
Remove Overloaded:
Remove(IsolatedStorageScope scope)

Removes the specified isolated storage scope for all identities.
ToString
(inherited from System.Object)
See base class member description: System.Object.ToString

Derived from System.Object, the primary base class for all objects.
Protected Properties
SeparatorExternal
(inherited from System.IO.IsolatedStorage.IsolatedStorage)
Read-only

See base class member description: System.IO.IsolatedStorage.IsolatedStorage.SeparatorExternal


Gets a backslash character that can be used in a directory string. When overridden in a derived class, another character might be returned.
SeparatorInternal
(inherited from System.IO.IsolatedStorage.IsolatedStorage)
Read-only

See base class member description: System.IO.IsolatedStorage.IsolatedStorage.SeparatorInternal


Gets a period character that can be used in a directory string. When overridden in a derived class, another character might be returned.
Protected Methods
Finalize Overridden:
Closes an isolated store. This method will run even if an exception is thrown or the program crashes.
GetPermission Overridden:
Returns the IsolatedStoragePermission from within a given permission set that represents access to isolated storage.
InitStore
(inherited from System.IO.IsolatedStorage.IsolatedStorage)
See base class member description: System.IO.IsolatedStorage.IsolatedStorage.InitStore


Initializes a new instance of the IsolatedStorage object.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.IO.IsolatedStorage.IsolatedStorageFile Member Details

Property: AssemblyIdentity (read-only)
Inherited
See base class member description: System.IO.IsolatedStorage.IsolatedStorage.AssemblyIdentity

Summary
Gets an assembly identity used to scope isolated storage.
C# Syntax:
public object AssemblyIdentity {get;}
Exceptions
Exception Type Condition
SecurityException The code lacks the required SecurityPermission to access this object.
.NET Framework Security:
SecurityPermission for the ability to access evidence. Associated enumeration: SecurityPermissionFlag.ControlPolicy

Return to top


Overridden Property: CurrentSize (read-only)
Summary
Gets the current size of the isolated storage.
This member is not CLS Compliant

C# Syntax:
[CLSCompliant(false)]
public override ulong CurrentSize {get;}
Exceptions
Exception Type Condition
InvalidOperationException The property is unavailable. The current store has a roaming scope or is not open.
Remarks
Represents the total usage of all files and directories within the isolated storage scope.

The current size cannot be accurately determined for stores that are participating in a roaming user profile. Because roaming profiles are often cached on multiple client machines and later synchronized with a server, quotas cannot be enforced for such stores and the current size is not reported.

The the conceptual topic at MSDN: anticipatingoutofspaceconditions example demonstrates the use of the CurrentSize property.

Return to top


Property: DomainIdentity (read-only)
Inherited
See base class member description: System.IO.IsolatedStorage.IsolatedStorage.DomainIdentity

Summary
Gets a domain identity that scopes isolated storage.
C# Syntax:
public object DomainIdentity {get;}
Exceptions
Exception Type Condition
SecurityException The code lacks the required SecurityPermission to access this object. These permissions are granted by the runtime based on security policy.
InvalidOperationException The IsolatedStorage is not isolated by the domain IsolatedStorageScope.
.NET Framework Security:
SecurityPermission for the ability to access evidence. Associated enumeration: SecurityPermissionFlag.ControlPolicy

Return to top


Overridden Property: MaximumSize (read-only)
Summary
Gets a value representing the maximum amount of space available for isolated storage within the limits established by the quota.
This member is not CLS Compliant

C# Syntax:
[CLSCompliant(false)]
public override ulong MaximumSize {get;}
Exceptions
Exception Type Condition
InvalidOperationException The property is unavailable. IsolatedStorageFile.MaximumSize cannot be determined without evidence from the assembly's creation. The evidence could not be determined when the object was created.
Remarks
The number of bytes available is constrained by the isolated storage quota set by the administrator. Quota is configured in security policy on the basis of evidence, so the same code can receive a different quota if it is run with different evidence. For example, an application that is run locally and also from a share on an intranet would likely receive different quotas.

The the conceptual topic at MSDN: anticipatingoutofspaceconditions example demonstrates the use of the MaximumSize property.

Return to top


Property: Scope (read-only)
Inherited
See base class member description: System.IO.IsolatedStorage.IsolatedStorage.Scope

Summary
Gets an IsolatedStorageScope enumeration value specifying the scope used to isolate the store.
C# Syntax:
public IsolatedStorageScope Scope {get;}
Remarks
Stores are isolated by a combination of factors (user, assembly, domain, and so on).

Return to top


Property: SeparatorExternal (read-only)
Inherited
See base class member description: System.IO.IsolatedStorage.IsolatedStorage.SeparatorExternal

Summary
Gets a backslash character that can be used in a directory string. When overridden in a derived class, another character might be returned.
C# Syntax:
protected virtual char SeparatorExternal {get;}
Remarks


Notes to inheritors: When you inherit from IsolatedStorage, you can override IsolatedStorage.SeparatorExternal and return a character other than the '\' to control the naming syntax of the store. In a Windows IsolatedStorageFile this separator is a '\'.

Return to top


Property: SeparatorInternal (read-only)
Inherited
See base class member description: System.IO.IsolatedStorage.IsolatedStorage.SeparatorInternal

Summary
Gets a period character that can be used in a directory string. When overridden in a derived class, another character might be returned.
C# Syntax:
protected virtual char SeparatorInternal {get;}
Remarks


Notes to inheritors: When you inherit from IsolatedStorage, you can override IsolatedStorage.SeparatorInternal and return a character other than the '.' to control the naming syntax of the store. In a Windows IsolatedStorageFile this separator is a '.'.

Return to top


Method: Close()
Summary
Closes a store previously opened with IsolatedStorageFile.GetStore, IsolatedStorageFile.GetUserStoreForAssembly, or IsolatedStorageFile.GetUserStoreForDomain.
C# Syntax:
public void Close();

Return to top


Method: CreateDirectory(
   string dir
)
Summary
Creates a directory in the isolated storage scope.
C# Syntax:
public void CreateDirectory(
   string dir
);
Parameters:

dir

The relative path of the directory to create within the isolated storage scope.

Exceptions
Exception Type Condition
IsolatedStorageException The current code has insufficient permissions to create isolated storage directory.
ArgumentNullException The directory path is null.
Remarks
The created directory initially contains no files. The the conceptual topic at MSDN: creatingfilesdirectories example demonstrates the use of the CreateDirectory method
.NET Framework Security:
IsolatedStorageFilePermission is required to access the isolated storage scope.

Return to top


Method: CreateObjRef(
   Type requestedType
)
Inherited
See base class member description: System.MarshalByRefObject.CreateObjRef

Summary
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
C# Syntax:
public virtual ObjRef CreateObjRef(
   Type requestedType
);
Parameters:

requestedType

The Type of the object that the new ObjRef will reference.

Return Value:
Information required to generate a proxy.
Exceptions
Exception Type Condition
RemotingException This instance is not a valid remoting object.

Return to top


Method: DeleteDirectory(
   string dir
)
Summary
Deletes a directory in the isolated storage scope.
C# Syntax:
public void DeleteDirectory(
   string dir
);
Parameters:

dir

The relative path of the directory to delete within the isolated storage scope.

Exceptions
Exception Type Condition
IsolatedStorageException The directory could not be deleted.
ArgumentNullException The directory path was null.
Remarks
A directory must be empty before it is deleted. The deleted directory cannot be recovered once deleted.

The the conceptual topic at MSDN: deletingfilesdirectories example demonstrates the use of the DeleteDirectory method.

.NET Framework Security:
IsolatedStorageFilePermission is required to access the isolated storage scope

Return to top


Method: DeleteFile(
   string file
)
Summary
Deletes a file in the isolated storage scope.
C# Syntax:
public void DeleteFile(
   string file
);
Parameters:

file

The relative path of the file to delete within the isolated storage scope.

Exceptions
Exception Type Condition
IsolatedStorageException The target file is open or the path is incorrect.
ArgumentNullException The file path is null.
Remarks
The deleted file cannot be recovered once deleted.

The the conceptual topic at MSDN: deletingfilesdirectories example demonstrates the use of the DeleteFile method.

.NET Framework Security:
IsolatedStorageFilePermission is required to access files in the isolated storage scope.

Return to top


Method: Dispose()
Summary
Closes a store previously opened with IsolatedStorageFile.GetStore, IsolatedStorageFile.GetUserStoreForAssembly, or IsolatedStorageFile.GetUserStoreForDomain.
C# Syntax:
public void Dispose();
Implements:
IDisposable.Dispose
Remarks
Call Dispose when you are finished using the IsolatedStorageFile. The Dispose method leaves the IsolatedStorageFile in an unusable state. After calling Dispose, you must release all references to the IsolatedStorageFile so the memory it was occupying can be reclaimed by garbage collection.

Note Always call Dispose before you release your last reference to the IsolatedStorageFile. Otherwise, the resources the IsolatedStorageFileStream is using will not be freed until garbage collection calls the IsolatedStorageFileStream object's destructor.

Return to top


Method: Equals(
   object obj
)
Inherited
See base class member description: System.Object.Equals
C# Syntax:
public virtual bool Equals(
   object obj
);

For more information on members inherited from System.Object click on the link above.

Return to top


Overridden Method: Finalize()
Summary
Closes an isolated store. This method will run even if an exception is thrown or the program crashes.
C# Syntax:
~IsolatedStorageFile();

Return to top


Method: GetDirectoryNames(
   string searchPattern
)
Summary
Enumerates directories in an isolated storage scope that match a given pattern.
C# Syntax:
public string[] GetDirectoryNames(
   string searchPattern
);
Parameters:

searchPattern

A search pattern. Both single-character ("?") and multicharacter ("*") wildcards are supported.

Return Value:
An Array of the relative paths of directories in the isolated storage scope that match searchPattern. A zero-length array specifies that there are no directories that match.
Exceptions
Exception Type Condition
ArgumentNullException The searchPattern was null.
Remarks
Wildcard characters must only be in the final element of a searchPattern. For instance, "directory1/*etc*" is a valid search string, but "*etc*/directory" is not.

For complete description of search string criteria, see the Directory class.

For information on getting file names, see the IsolatedStorageFile.GetFileNames method.

The the conceptual topic at MSDN: findingexistingfilesdirectories example demonstrates the use of the GetDirectoryNames method.

Example
The searchPattern "Project\Data*" will give all subdirectories of Project beginning with Data in the isolated storage scope. The searchPattern "*" will return all directories located in the root.
.NET Framework Security:
FileIOPermission for the ability to read a directory. Associated enumeration: FileIOPermissionAccess. FileIOPermissionAccess.Read

Return to top


Method: GetEnumerator(
   IsolatedStorageScope scope
)
Summary
Gets the enumerator for the IsolatedStorageFile stores within an isolated storage scope.
C# Syntax:
public static IEnumerator GetEnumerator(
   IsolatedStorageScope scope
);
Parameters:

scope

Represents the IsolatedStorageScope for which to return isolated stores.User and User|Roaming are the only IsolatedStorageScope combinations supported.

Return Value:
Enumerator for the IsolatedStorageFile stores within the specified isolated storage scope.
Remarks
The the conceptual topic at MSDN: enumeratingstores example demonstrates the use of the GetEnumerator method.
.NET Framework Security:
IsolatedStorageFilePermission for permission to use isolated storage. Associated Enumeration: IsolatedStorageContainment.AdministerIsolatedStorageByUser

Return to top


Method: GetFileNames(
   string searchPattern
)
Summary
Enumerates files in isolated storage scope that match a given pattern.
C# Syntax:
public string[] GetFileNames(
   string searchPattern
);
Parameters:

searchPattern

A search pattern. Both single-character ("?") and multicharacter ("*") wildcards are supported.

Return Value:
An Array of relative paths of files in the isolated storage scope that match searchPattern. A zero-length array specifies that there are no files that match.
Exceptions
Exception Type Condition
ArgumentNullException The searchPattern was null.
Remarks
For complete description of search pattern strings, see Directory.

For information about how to find directory names, see the IsolatedStorageFile.GetDirectoryNames method.

The the conceptual topic at MSDN: findingexistingfilesdirectories example demonstrates the use of the GetFileNames method.

Example
The searchPattern "Project\Data*.txt" will give all ".txt" files beginning with Data in the Project directory of the isolated storage scope.
.NET Framework Security:
FileIOPermission for the ability to read a directory. Associated enumeration: FileIOPermissionAccess. FileIOPermissionAccess.Read

Return to top


Method: GetHashCode()
Inherited
See base class member description: System.Object.GetHashCode
C# Syntax:
public virtual int GetHashCode();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetLifetimeService()
Inherited
See base class member description: System.MarshalByRefObject.GetLifetimeService

Summary
Retrieves the current lifetime service object that controls the lifetime policy for this instance.
C# Syntax:
public object GetLifetimeService();
Return Value:
An object of type ILease used to control the lifetime policy for this instance.
Remarks
For more information about lifetime services, see the LifetimeServices class.

Return to top


Overridden Method: GetPermission(
   PermissionSet ps
)
Summary
Returns the IsolatedStoragePermission from within a given permission set that represents access to isolated storage.
C# Syntax:
protected override IsolatedStoragePermission GetPermission(
   PermissionSet ps
);
Parameters:

ps

The PermissionSet that contains the set of permissions granted to code that is attempting to use isolated storage.

Return Value:
An IsolatedStoragePermission object that represents the IsolatedStorageFile object in the supplied permission set. The value is null if there is no permission of type IsolatedStorageFilePermission in the supplied set.
Remarks
This method is called during a store's initialization to determine the isolated storage file permissions that are granted to an assembly. The IsolatedStorage base class uses these permissions to determine the quota.

Return to top


Overloaded Method: GetStore(
   IsolatedStorageScope scope,
   object domainIdentity,
   object assemblyIdentity
)
Summary
Obtains the isolated storage corresponding to the given application domain and assembly evidence objects.
C# Syntax:
public static IsolatedStorageFile GetStore(
   IsolatedStorageScope scope,
   object domainIdentity,
   object assemblyIdentity
);
Parameters:

scope

A bitwise combination of the IsolatedStorageScope values.

domainIdentity

An Object that contains evidence for the application domain identity. Use null to indicate that the current application's domain evidence should be used.

assemblyIdentity

An Object that contains evidence for the code assembly identity. Use null to indicate that the current assembly's evidence should be used.

Return Value:
An IsolatedStorageFile representing the parameters.
Exceptions
Exception Type Condition
SecurityException Sufficient isolated storage permissions have not been granted.
ArgumentNullException Neither the domainIdentity nor assemblyIdentity have been passed in. This verifies that the correct constructor is being used.
Remarks
This is the overload of IsolatedStorageFile.GetStore most likely to be called from application code.

For example, to open a store for your assembly that is capable of roaming and is the same across applications, you can use the following code:

              IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Assembly | IsolatedStorageScope.Roaming;
              IsolatedStorageFile store = IsolatedStorageFile.GetStore(scope, null, null);
            

Alternatively, to open a store that is capable of roaming and is unique to an application for the same assembly, you can use the following code:

              IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain | IsolatedStorageScope.Roaming;
              IsolatedStorageFile store = IsolatedStorageFile.GetStore(scope, null, null);
            
.NET Framework Security:
IsolatedStorageFilePermission for permission to use isolated storage. Associated Enumeration: IsolatedStorageContainment.AdministerIsolatedStorageByUser
See also:
IsolatedStorageFile.GetUserStoreForAssembly | IsolatedStorageFile.GetUserStoreForDomain

Return to top


Overloaded Method: GetStore(
   IsolatedStorageScope scope,
   Type domainEvidenceType,
   Type assemblyEvidenceType
)
Summary
Obtains isolated storage corresponding to the isolated storage scope given the application domain and assembly evidence types.
C# Syntax:
public static IsolatedStorageFile GetStore(
   IsolatedStorageScope scope,
   Type domainEvidenceType,
   Type assemblyEvidenceType
);
Parameters:

scope

A bitwise combination of the IsolatedStorageScope values.

domainEvidenceType

The identity Type to choose from the application domain evidence.

assemblyEvidenceType

The identity Type to choose from the application code assembly evidence.

Return Value:
An IsolatedStorageFile representing the parameters.
Exceptions
Exception Type Condition
SecurityException Sufficient isolated storage permissions have not been granted.
Remarks
This overload of GetStore opens an isolated store for the evidence types that are passed in.
.NET Framework Security:
IsolatedStorageFilePermission for permission to use isolated storage. Associated Enumeration: IsolatedStorageContainment.AdministerIsolatedStorageByUser

Return to top


Overloaded Method: GetStore(
   IsolatedStorageScope scope,
   Evidence domainEvidence,
   Type domainEvidenceType,
   Evidence assemblyEvidence,
   Type assemblyEvidenceType
)
Summary
Obtains isolated storage corresponding to the given application domain and the assembly evidence objects and types.
C# Syntax:
public static IsolatedStorageFile GetStore(
   IsolatedStorageScope scope,
   Evidence domainEvidence,
   Type domainEvidenceType,
   Evidence assemblyEvidence,
   Type assemblyEvidenceType
);
Parameters:

scope

A bitwise combination of the IsolatedStorageScope values.

domainEvidence

An Evidence object containing the application domain identity.

domainEvidenceType

The identity Type to choose from the application domain evidence.

assemblyEvidence

An Evidence object containing the code assembly identity.

assemblyEvidenceType

The identity Type to choose from the application code assembly evidence.

Return Value:
An IsolatedStorageFile representing the parameters.
Exceptions
Exception Type Condition
SecurityException Sufficient isolated storage permissions have not been granted.
ArgumentNullException The domainEvidence or assemblyEvidence identity has not been passed in.
Remarks
This form of GetStore is most useful for administrative code that needs to open a store as if it were another assembly. The store is opened for the evidence provided and not for the currently executing assembly.
.NET Framework Security:
IsolatedStorageFilePermission for permission to use isolated storage. Associated Enumeration: IsolatedStorageContainment.AdministerIsolatedStorageByUser

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetUserStoreForAssembly()
Summary
Obtains isolated storage corresponding to the calling code's assembly identity.
C# Syntax:
public static IsolatedStorageFile GetUserStoreForAssembly();
Return Value:
An IsolatedStorageFile corresponding to the isolated storage scope based on the calling code's assembly identity.
Exceptions
Exception Type Condition
SecurityException Sufficient isolated storage permissions have not been granted.
Remarks
The same assembly within different applications always use the same isolated store when using this method.

GetUserStoreForAssembly is functionally equivalent to :

              GetStore(IsolatedStorageScope.Assembly | IsolatedStorageScope.User, null, null);
            


Note Different assemblies running within the same application domain always have distinct isolated stores.
.NET Framework Security:
IsolatedStorageFilePermission for permission to use isolated storage. Associated Enumeration: IsolatedStorageContainment.AdministerIsolatedStorageByUser

Return to top


Method: GetUserStoreForDomain()
Summary
Obtains isolated storage corresponding to the application domain identity and assembly identity.
C# Syntax:
public static IsolatedStorageFile GetUserStoreForDomain();
Return Value:
An IsolatedStorageFile corresponding to the IsolatedStorageScope, based on a combination of the application domain identity and the assembly identity.
Exceptions
Exception Type Condition
SecurityException Sufficient isolated storage permissions have not been granted.
IsolatedStorageException The store failed to open.
Remarks
The same assembly code will use different isolated stores when used in the context of different applications.

GetUserStoreForDomain is functionally equivalent to:

              GetStore(IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain | IsolatedStorageScope.User, null, null);
            

Different assemblies running within the same application domain always have distinct isolated stores.

.NET Framework Security:
IsolatedStorageFilePermission for permission to use isolated storage. Associated Enumeration: IsolatedStorageContainment.AdministerIsolatedStorageByUser

Return to top


Method: InitializeLifetimeService()
Inherited
See base class member description: System.MarshalByRefObject.InitializeLifetimeService

Summary
Obtains a lifetime service object to control the lifetime policy for this instance.
C# Syntax:
public virtual object InitializeLifetimeService();
Return Value:
An object of type ILease used to control the lifetime policy for this instance. This is the current lifetime service object for this instance if one exists; otherwise, a new lifetime service object initialized to the value of the LifetimeServices.LeaseManagerPollTime property.
Remarks
For more information about lifetime services, see the LifetimeServices class.
Example
The following code example demonstrates creating a lease.
 public class MyClass : MarshalByRefObject
 {
   public override Object InitializeLifetimeService()
   {
     ILease lease = (ILease)base.InitializeLifetimeService();
     if (lease.CurrentState == LeaseState.Initial)
     {
          lease.InitialLeaseTime = TimeSpan.FromMinutes(1);
          lease.SponsorshipTimeout = TimeSpan.FromMinutes(2);
           lease.RenewOnCallTime = TimeSpan.FromSeconds(2);
     }
       return lease;
   }
 }

    

Return to top


Method: InitStore(
   IsolatedStorageScope scope,
   Type domainEvidenceType,
   Type assemblyEvidenceType
)
Inherited
See base class member description: System.IO.IsolatedStorage.IsolatedStorage.InitStore

Summary
Initializes a new instance of the IsolatedStorage object.
C# Syntax:
protected void InitStore(
   IsolatedStorageScope scope,
   Type domainEvidenceType,
   Type assemblyEvidenceType
);
Parameters:

scope

A bitwise combination of the IsolatedStorageScope values. A bitwise combination of the IsolatedStorageScope values.

domainEvidenceType

The type of the Evidence that you can chose from the list of Evidence present in the domain of the calling application.null lets the IsolatedStorage choose the evidence. The type of the Evidence that you can chose from the list of Evidence present in the domain of the calling application.null lets the IsolatedStorage choose the evidence.

assemblyEvidenceType

The type of the Evidence that you can chose from the list of Evidence present in the domain of the calling application.null lets the IsolatedStorage choose the evidence. The type of the Evidence that you can chose from the list of Evidence present in the domain of the calling application.null lets the IsolatedStorage choose the evidence.

Exceptions
Exception Type Condition
IsolatedStorageException The assembly specified has insufficient permissions to create isolated stores.
Remarks
Derived classes use this method to initialize a new instance.
.NET Framework Security:
IsolatedStorageFilePermission for permission to use isolated storage. Associated enumeration: IsolatedStorageContainment.DomainIsolationByUser

-or-

IsolatedStorageContainment.AssemblyIsolationByUser

-or-

IsolatedStorageContainment.DomainIsolationByRoamingUser

-or-

IsolatedStorageContainment.AssemblyIsolationByRoamingUser

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Overloaded Method: Remove()
Summary
Removes the isolated storage scope and all its contents.
C# Syntax:
public override void Remove();
Exceptions
Exception Type Condition
IsolatedStorageException The isolated store cannot be deleted.
Remarks
This method irrevocably removes the entire scope and all contained directories and files. The the conceptual topic at MSDN: deletingstores example demonstrates the use of the Remove method.

Return to top


Overloaded Method: Remove(
   IsolatedStorageScope scope
)
Summary
Removes the specified isolated storage scope for all identities.
C# Syntax:
public static void Remove(
   IsolatedStorageScope scope
);
Parameters:

scope

A bitwise combination of the IsolatedStorageScope values.

Exceptions
Exception Type Condition
IsolatedStorageException The isolated store cannot be removed.
Remarks
This method irrevocably removes the entire scope and all contained directories and files. The the conceptual topic at MSDN: deletingstores example demonstrates the use of the Remove method.
.NET Framework Security:
IsolatedStorageFilePermission for permission to use isolated storage. Associated Enumeration: IsolatedStorageContainment.AdministerIsolatedStorageByUser

Return to top


Method: ToString()
Inherited
See base class member description: System.Object.ToString
C# Syntax:
public virtual string ToString();

For more information on members inherited from System.Object click on the link above.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.