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).

适用于