WindowsRuntimeStreamExtensions.AsRandomAccessStream(Stream) 方法

定義

重要

此 API 不符合 CLS 規範。

將指定的資料流轉換為隨機存取資料流。Converts the specified stream to a random access stream.

public:
[System::Runtime::CompilerServices::Extension]
 static Windows::Storage::Streams::IRandomAccessStream ^ AsRandomAccessStream(System::IO::Stream ^ stream);
[System.CLSCompliant(false)]
public static Windows.Storage.Streams.IRandomAccessStream AsRandomAccessStream (this System.IO.Stream stream);
static member AsRandomAccessStream : System.IO.Stream -> Windows.Storage.Streams.IRandomAccessStream

參數

stream
Stream

要轉換的資料流。The stream to convert.

傳回

代表已轉換之資料流的 Windows 執行階段 IRandomAccessStreamA Windows Runtime IRandomAccessStream, which represents the converted stream.

屬性

備註

注意

在 Visual Basic 和C#中, 您可以在類型Stream的任何物件上呼叫這個方法做為實例方法。In Visual Basic and C#, you can call this method as an instance method on any object of type Stream. 使用執行個體方法語法呼叫這個方法時,請省略第一個參數。When you use instance method syntax to call this method, omit the first parameter. 如需詳細資訊, 請參閱擴充方法 (Visual Basic)擴充C#方法 (程式設計手冊)For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

適用於