Прочетете на английски Редактиране

Споделяне чрез


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)

Source:
IsolatedStorageFile.cs
Source:
IsolatedStorageFile.cs
Source:
IsolatedStorageFile.cs

Opens a file in the specified mode.

C#
public System.IO.IsolatedStorage.IsolatedStorageFileStream OpenFile(string path, System.IO.FileMode mode);
C#
[System.Runtime.InteropServices.ComVisible(false)]
public System.IO.IsolatedStorage.IsolatedStorageFileStream OpenFile(string path, System.IO.FileMode mode);

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

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.

See also

Applies to

.NET 10 и други версии
Продукт Версии
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

OpenFile(String, FileMode, FileAccess)

Source:
IsolatedStorageFile.cs
Source:
IsolatedStorageFile.cs
Source:
IsolatedStorageFile.cs

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

C#
public System.IO.IsolatedStorage.IsolatedStorageFileStream OpenFile(string path, System.IO.FileMode mode, System.IO.FileAccess access);
C#
[System.Runtime.InteropServices.ComVisible(false)]
public System.IO.IsolatedStorage.IsolatedStorageFileStream OpenFile(string path, System.IO.FileMode mode, System.IO.FileAccess access);

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

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.

See also

Applies to

.NET 10 и други версии
Продукт Версии
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

OpenFile(String, FileMode, FileAccess, FileShare)

Source:
IsolatedStorageFile.cs
Source:
IsolatedStorageFile.cs
Source:
IsolatedStorageFile.cs

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

C#
public System.IO.IsolatedStorage.IsolatedStorageFileStream OpenFile(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share);
C#
[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);

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

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.

See also

Applies to

.NET 10 и други версии
Продукт Версии
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0