IRandomAccessStreamReference 介面

定義

讓Windows 執行階段元件能夠存取封裝的資料流程。

public interface class IRandomAccessStreamReference
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(871248180, 7638, 20026, 128, 103, 209, 193, 98, 232, 100, 43)]
struct IRandomAccessStreamReference
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Guid(871248180, 7638, 20026, 128, 103, 209, 193, 98, 232, 100, 43)]
public interface IRandomAccessStreamReference
Public Interface IRandomAccessStreamReference
衍生
屬性

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

備註

當您的Windows 執行階段元件向呼叫端公開隨機存取資料流程時,實作 IRandomAccessStreamReference 介面。 如果是循序唯讀資料流程,請實作 IInputStreamReference 介面。

例如, StorageFile 會為檔案的內容提供 IRandomAccessStream ,因此它會實作 IRandomAccessStreamReference 介面。 通常,提供資料流程需要存取硬碟,因此資料流程作業是非同步。 取用檔案內容的元件會收到 IRandomAccessStreamReference 而不是 StorageFile 參考,因為此介面是輸入參數的最低需求。

重要

並非所有來源都能有效率地提供隨機存取資料流程。 如果元件只需要循序讀取存取,請考慮實作 IInputStreamReference 介面,而不是 IRandomAccessStreamReference 介面。

方法

OpenReadAsync()

開啟串流以進行隨機存取。

適用於

另請參閱