IsolatedStorageFile.OpenFile 方法

定义

使用指定的共享和访问选项打开文件。

重载

OpenFile(String, FileMode)

在指定的模式中打开文件。

OpenFile(String, FileMode, FileAccess)

用指定的读/写访问权限在指定模式下打开文件。

OpenFile(String, FileMode, FileAccess, FileShare)

用指定的读/写访问权限和共享权限在指定的模式下打开文件。

OpenFile(String, FileMode)

在指定的模式中打开文件。

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

参数

path
String

独立存储区内文件的相对路径。

mode
FileMode

指定如何打开文件的枚举值之一。

返回

IsolatedStorageFileStream

在指定模式下打开、具有读/写访问权限且不共享的文件。

属性

例外

已移除独立存储区。

  • 或 -

已禁用独立存储。

path 的格式不正确。

pathnull

path 中的目录不存在。

未找到任何文件,且 mode 设置为 Open

已释放独立存储区。

注解

此方法等效于使用 IsolatedStorageFileStream.IsolatedStorageFileStream(String, FileMode, IsolatedStorageFile) 构造函数。

另请参阅

适用于

OpenFile(String, FileMode, FileAccess)

用指定的读/写访问权限在指定模式下打开文件。

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

参数

path
String

独立存储区内文件的相对路径。

mode
FileMode

指定如何打开文件的枚举值之一。

access
FileAccess

指定是否将用读、写或读/写访问权限打开文件的枚举值之一。

返回

IsolatedStorageFileStream

用指定模式和访问权限打开且不共享的文件。

属性

例外

已移除独立存储区。

  • 或 -

已禁用独立存储。

path 的格式不正确。

pathnull

path 中的目录不存在。

未找到任何文件,且 mode 设置为 Open

已释放独立存储区。

注解

此方法等效于使用 IsolatedStorageFileStream.IsolatedStorageFileStream(String, FileMode, FileAccess, IsolatedStorageFile) 构造函数。

另请参阅

适用于

OpenFile(String, FileMode, FileAccess, FileShare)

用指定的读/写访问权限和共享权限在指定的模式下打开文件。

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

参数

path
String

独立存储区内文件的相对路径。

mode
FileMode

指定如何打开或创建文件的枚举值之一。

access
FileAccess

指定是否将用读、写或读/写访问权限打开文件的枚举值之一。

share
FileShare

用于指定其他 IsolatedStorageFileStream 对象对此文件具有哪种访问权限的枚举值的按位组合。

返回

IsolatedStorageFileStream

用指定的模式和访问权限以及指定的共享选项打开的文件。

属性

例外

已移除独立存储区。

  • 或 -

已禁用独立存储。

path 的格式不正确。

pathnull

path 中的目录不存在。

未找到任何文件,且 mode 设置为 Open(FileMode)

已释放独立存储区。

注解

此方法等效于使用 IsolatedStorageFileStream.IsolatedStorageFileStream(String, FileMode, FileAccess, FileShare, IsolatedStorageFile) 构造函数。

另请参阅

适用于