共用方式為


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 介面的新 Managed 物件。

Dispose()

執行與釋放 (Free)、釋放 (Release) 或重設 Unmanaged 資源相關聯之應用程式定義的工作。

適用於

另請參閱