FileRandomAccessStream.OpenAsync 方法

定义

重载

OpenAsync(String, FileAccessMode)

在给定文件路径的情况下打开指向现有文件的流。

OpenAsync(String, FileAccessMode, StorageOpenOptions, FileOpenDisposition)

在给定文件路径的情况下打开指向文件的流。 如果该文件不存在,可以使用 FileOpenDisposition 创建它。

OpenAsync(String, FileAccessMode)

在给定文件路径的情况下打开指向现有文件的流。

public:
 static IAsyncOperation<IRandomAccessStream ^> ^ OpenAsync(Platform::String ^ filePath, FileAccessMode accessMode);
/// [Windows.Foundation.Metadata.Overload("OpenAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<IRandomAccessStream> OpenAsync(winrt::hstring const& filePath, FileAccessMode const& accessMode);
[Windows.Foundation.Metadata.Overload("OpenAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<IRandomAccessStream> OpenAsync(string filePath, FileAccessMode accessMode);
function openAsync(filePath, accessMode)
Public Shared Function OpenAsync (filePath As String, accessMode As FileAccessMode) As IAsyncOperation(Of IRandomAccessStream)

参数

filePath
String

Platform::String

winrt::hstring

要打开的文件的路径。

accessMode
FileAccessMode

用于打开流的权限级别。

返回

流式传输到指定文件。

属性

Windows 要求

设备系列
Windows 10 Fall Creators Update (在 10.0.16299.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v5.0 中引入)

适用于

OpenAsync(String, FileAccessMode, StorageOpenOptions, FileOpenDisposition)

在给定文件路径的情况下打开指向文件的流。 如果该文件不存在,可以使用 FileOpenDisposition 创建它。

public:
 static IAsyncOperation<IRandomAccessStream ^> ^ OpenAsync(Platform::String ^ filePath, FileAccessMode accessMode, StorageOpenOptions sharingOptions, FileOpenDisposition openDisposition);
/// [Windows.Foundation.Metadata.Overload("OpenWithOptionsAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
 static IAsyncOperation<IRandomAccessStream> OpenAsync(winrt::hstring const& filePath, FileAccessMode const& accessMode, StorageOpenOptions const& sharingOptions, FileOpenDisposition const& openDisposition);
[Windows.Foundation.Metadata.Overload("OpenWithOptionsAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<IRandomAccessStream> OpenAsync(string filePath, FileAccessMode accessMode, StorageOpenOptions sharingOptions, FileOpenDisposition openDisposition);
function openAsync(filePath, accessMode, sharingOptions, openDisposition)
Public Shared Function OpenAsync (filePath As String, accessMode As FileAccessMode, sharingOptions As StorageOpenOptions, openDisposition As FileOpenDisposition) As IAsyncOperation(Of IRandomAccessStream)

参数

filePath
String

Platform::String

winrt::hstring

要打开的文件的路径。

accessMode
FileAccessMode

用于打开流的权限级别。

sharingOptions
StorageOpenOptions

枚举值的按位组合,指定用于打开流的选项。

openDisposition
FileOpenDisposition

要对文件执行的操作。

返回

流式传输到指定文件。

属性

Windows 要求

设备系列
Windows 10 Fall Creators Update (在 10.0.16299.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v5.0 中引入)

适用于