IsolatedStorageFile.OpenFile Method

Definition

Opens a file using the specified sharing and access options.

Overloads

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.

OpenFile(String, FileMode)

Opens a file in the specified mode.

public:
 System::IO::IsolatedStorage::IsolatedStorageFileStream ^ OpenFile(System::String ^ path, System::IO::FileMode mode);
public System.IO.IsolatedStorage.IsolatedStorageFileStream OpenFile (string path, System.IO.FileMode mode);
[System.Runtime.InteropServices.ComVisible(false)]
public System.IO.IsolatedStorage.IsolatedStorageFileStream OpenFile (string path, System.IO.FileMode mode);
member this.OpenFile : string * System.IO.FileMode -> System.IO.IsolatedStorage.IsolatedStorageFileStream
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.OpenFile : string * System.IO.FileMode -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Function OpenFile (path As String, mode As FileMode) As IsolatedStorageFileStream

Parameters

path
String

The relative path of the file within the isolated store.

mode
FileMode

One of the enumeration values that specifies how to open the file.

Returns

IsolatedStorageFileStream

A file that is opened in the specified mode, with read/write access, and is unshared.

Attributes

Exceptions

The isolated store has been removed.

-or-

Isolated storage is disabled.

path is malformed.

path is null.

The directory in path does not exist.

No file was found and the mode is set to Open.

The isolated store has been disposed.

Remarks

This method is equivalent to using the IsolatedStorageFileStream.IsolatedStorageFileStream(String, FileMode, IsolatedStorageFile) constructor.

Applies to

OpenFile(String, FileMode, FileAccess)

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

public:
 System::IO::IsolatedStorage::IsolatedStorageFileStream ^ OpenFile(System::String ^ path, System::IO::FileMode mode, System::IO::FileAccess access);
public System.IO.IsolatedStorage.IsolatedStorageFileStream OpenFile (string path, System.IO.FileMode mode, System.IO.FileAccess access);
[System.Runtime.InteropServices.ComVisible(false)]
public System.IO.IsolatedStorage.IsolatedStorageFileStream OpenFile (string path, System.IO.FileMode mode, System.IO.FileAccess access);
member this.OpenFile : string * System.IO.FileMode * System.IO.FileAccess -> System.IO.IsolatedStorage.IsolatedStorageFileStream
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.OpenFile : string * System.IO.FileMode * System.IO.FileAccess -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Function OpenFile (path As String, mode As FileMode, access As FileAccess) As IsolatedStorageFileStream

Parameters

path
String

The relative path of the file within the isolated store.

mode
FileMode

One of the enumeration values that specifies how to open the file.

access
FileAccess

One of the enumeration values that specifies whether the file will be opened with read, write, or read/write access.

Returns

IsolatedStorageFileStream

A file that is opened in the specified mode and access, and is unshared.

Attributes

Exceptions

The isolated store has been removed.

-or-

Isolated storage is disabled.

path is malformed.

path is null.

The directory in path does not exist.

No file was found and the mode is set to Open.

The isolated store has been disposed.

Remarks

This method is equivalent to using the IsolatedStorageFileStream.IsolatedStorageFileStream(String, FileMode, FileAccess, IsolatedStorageFile) constructor.

Applies to

OpenFile(String, FileMode, FileAccess, FileShare)

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

public:
 System::IO::IsolatedStorage::IsolatedStorageFileStream ^ OpenFile(System::String ^ path, System::IO::FileMode mode, System::IO::FileAccess access, System::IO::FileShare share);
public System.IO.IsolatedStorage.IsolatedStorageFileStream OpenFile (string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share);
[System.Runtime.InteropServices.ComVisible(false)]
public System.IO.IsolatedStorage.IsolatedStorageFileStream OpenFile (string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share);
member this.OpenFile : string * System.IO.FileMode * System.IO.FileAccess * System.IO.FileShare -> System.IO.IsolatedStorage.IsolatedStorageFileStream
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.OpenFile : string * System.IO.FileMode * System.IO.FileAccess * System.IO.FileShare -> System.IO.IsolatedStorage.IsolatedStorageFileStream
Public Function OpenFile (path As String, mode As FileMode, access As FileAccess, share As FileShare) As IsolatedStorageFileStream

Parameters

path
String

The relative path of the file within the isolated store.

mode
FileMode

One of the enumeration values that specifies how to open or create the file.

access
FileAccess

One of the enumeration values that specifies whether the file will be opened with read, write, or read/write access

share
FileShare

A bitwise combination of enumeration values that specify the type of access other IsolatedStorageFileStream objects have to this file.

Returns

IsolatedStorageFileStream

A file that is opened in the specified mode and access, and with the specified sharing options.

Attributes

Exceptions

The isolated store has been removed.

-or-

Isolated storage is disabled.

path is malformed.

path is null.

The directory in path does not exist.

No file was found and the mode is set to Open(FileMode).

The isolated store has been disposed.

Remarks

This method is equivalent to using the IsolatedStorageFileStream.IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, IsolatedStorageFile) constructor.

Applies to