WindowsRuntimeBufferExtensions.GetWindowsRuntimeBuffer 方法

定义

重载

GetWindowsRuntimeBuffer(MemoryStream)

返回一个 Windows.Storage.Streams.IBuffer 接口,该接口将同一内存表示为指定内存流。Returns a Windows.Storage.Streams.IBuffer interface that represents the same memory as the specified memory stream.

GetWindowsRuntimeBuffer(MemoryStream, Int32, Int32)

返回一个 Windows.Storage.Streams.IBuffer 接口,该接口表示由指定内存流所表示的内存中的一个区域。Returns a Windows.Storage.Streams.IBuffer interface that represents a region within the memory that the specified memory stream represents.

GetWindowsRuntimeBuffer(MemoryStream)

重要

此 API 不符合 CLS。

返回一个 Windows.Storage.Streams.IBuffer 接口,该接口将同一内存表示为指定内存流。Returns a Windows.Storage.Streams.IBuffer interface that represents the same memory as the specified memory stream.

public:
[System::Runtime::CompilerServices::Extension]
 static Windows::Storage::Streams::IBuffer ^ GetWindowsRuntimeBuffer(System::IO::MemoryStream ^ underlyingStream);
[System.CLSCompliant(false)]
public static Windows.Storage.Streams.IBuffer GetWindowsRuntimeBuffer (this System.IO.MemoryStream underlyingStream);
static member GetWindowsRuntimeBuffer : System.IO.MemoryStream -> Windows.Storage.Streams.IBuffer
<Extension()>
Public Function GetWindowsRuntimeBuffer (underlyingStream As MemoryStream) As IBuffer

参数

underlyingStream
MemoryStream

为 IBuffer 提供备份内存的流。The stream that provides the backing memory for the IBuffer.

返回

由支持指定内存流的同一内存支持的 Windows.Storage.Streams.IBuffer 接口。A Windows.Storage.Streams.IBuffer interface that is backed by the same memory that backs the specified memory stream.

属性

GetWindowsRuntimeBuffer(MemoryStream, Int32, Int32)

重要

此 API 不符合 CLS。

返回一个 Windows.Storage.Streams.IBuffer 接口,该接口表示由指定内存流所表示的内存中的一个区域。Returns a Windows.Storage.Streams.IBuffer interface that represents a region within the memory that the specified memory stream represents.

public:
[System::Runtime::CompilerServices::Extension]
 static Windows::Storage::Streams::IBuffer ^ GetWindowsRuntimeBuffer(System::IO::MemoryStream ^ underlyingStream, int positionInStream, int length);
[System.CLSCompliant(false)]
public static Windows.Storage.Streams.IBuffer GetWindowsRuntimeBuffer (this System.IO.MemoryStream underlyingStream, int positionInStream, int length);
static member GetWindowsRuntimeBuffer : System.IO.MemoryStream * int * int -> Windows.Storage.Streams.IBuffer
<Extension()>
Public Function GetWindowsRuntimeBuffer (underlyingStream As MemoryStream, positionInStream As Integer, length As Integer) As IBuffer

参数

underlyingStream
MemoryStream

与 IBuffer 共享内存的流。The stream that shares memory with the IBuffer.

positionInStream
Int32

共享内存区域在 underlyingStream 中的位置。The position of the shared memory region in underlyingStream.

length
Int32

共享内存区域的最大大小。The maximum size of the shared memory region. 如果 underlyingStream 中自 positionInStream 开始的字节数小于 length,则返回的 IBuffer 只表示可用字节数。If the number of bytes in underlyingStream, starting at positionInStream, is less than length, the IBuffer that is returned represents only the available bytes.

返回

由支持指定内存流的内存中的一个区域支持的 Windows.Storage.Streams.IBuffer 接口。A Windows.Storage.Streams.IBuffer interface that is backed by a region within the memory that backs the specified memory stream.

属性

异常

underlyingStream 为 null。underlyingStream is null.

positionInStreamlength 小于 0(零)。positionInStream or length is less than 0 (zero).

positionInStream 超出 source 的末尾。positionInStream is beyond the end of source.

underlyingStream 无法公开其基础的内存缓冲区。underlyingStream cannot expose its underlying memory buffer.

underlyingStream 已关闭。underlyingStream has been closed.

适用于