共用方式為


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 引進)

適用於