MemoryBuffer 类

定义

表示引用计数内存缓冲区。

public ref class MemoryBuffer sealed : IClosable, IMemoryBuffer
/// [Windows.Foundation.Metadata.Activatable(Windows.Foundation.IMemoryBufferFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class MemoryBuffer final : IClosable, IMemoryBuffer
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Foundation.IMemoryBufferFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class MemoryBuffer final : IClosable, IMemoryBuffer
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Foundation.IMemoryBufferFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class MemoryBuffer : System.IDisposable, IMemoryBuffer
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Foundation.IMemoryBufferFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class MemoryBuffer : System.IDisposable, IMemoryBuffer
function MemoryBuffer(capacity)
Public NotInheritable Class MemoryBuffer
Implements IDisposable, IMemoryBuffer
继承
Object Platform::Object IInspectable MemoryBuffer
属性
实现

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

注解

此类型还实现 COM 接口 IMemoryBufferByteAccess,该接口提供对缓冲区存储的直接访问。 有关如何访问缓冲区的 C# 示例,请参阅 自定义效果示例

注意

C++/WinRT 提供 上的 MemoryBuffer 扩展方法来直接访问数据。 各种语言和运行时提供访问进程内存的独特方式。 访问缓冲区时要小心,因为内存的生命周期与接口的 IMemoryBufferByteAccess 生命周期相关。

构造函数

MemoryBuffer(UInt32)

使用指定的容量初始化新的 MemoryBuffer 实例。

方法

Close()

断开此 MemoryBuffer 对象与实际内存缓冲区的连接。

CreateReference()

返回实现 IMemoryBufferReference 接口的新托管对象。

Dispose()

执行与释放或重置非托管资源关联的应用程序定义的任务。

适用于

另请参阅