Share via


MemoryBuffer Kelas

Definisi

Mewakili buffer memori yang dihitung referensi.

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
Warisan
Object Platform::Object IInspectable MemoryBuffer
Atribut
Penerapan

Persyaratan Windows

Rangkaian perangkat
Windows 10 (diperkenalkan dalam 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (diperkenalkan dalam v1.0)

Keterangan

Jenis ini juga mengimplementasikan antarmuka COM IMemoryBufferByteAccess, yang menyediakan akses langsung ke penyimpanan buffer. Lihat sampel Efek Kustom untuk contoh C# tentang cara mengakses buffer.

Catatan

C++/WinRT menyediakan metode MemoryBuffer ekstensi untuk mengakses data secara langsung. Berbagai bahasa dan runtime menyediakan cara unik untuk mengakses memori proses. Berhati-hatilah saat mengakses buffer karena siklus hidup memori terkait dengan siklus IMemoryBufferByteAccess hidup antarmuka.

Konstruktor

MemoryBuffer(UInt32)

Menginisialisasi instans MemoryBuffer baru dengan kapasitas yang ditentukan.

Metode

Close()

Putuskan sambungan objek MemoryBuffer ini dari buffer memori aktual.

CreateReference()

Mengembalikan objek terkelola baru yang mengimplementasikan antarmuka IMemoryBufferReference .

Dispose()

Melakukan tugas yang ditentukan aplikasi yang terkait dengan membebaskan, melepaskan, atau mereset sumber daya yang tidak terkelola.

Berlaku untuk

Lihat juga