public void CmdClearAttachments(MgClearAttachment[] pAttachments, MgClearRect[] pRects) { var attachmentHandle = GCHandle.Alloc(pAttachments, GCHandleType.Pinned); var rectsHandle = GCHandle.Alloc(pRects, GCHandleType.Pinned); try { unsafe { var attachmentCount = (uint)pAttachments.Length; var attachment = attachmentHandle.AddrOfPinnedObject(); var rectCount = (uint)pRects.Length; var rects = rectsHandle.AddrOfPinnedObject(); Interops.vkCmdClearAttachments(this.Handle, attachmentCount, (Magnesium.MgClearAttachment *)attachment.ToPointer(), rectCount, (Magnesium.MgClearRect *)rects.ToPointer()); } } finally { rectsHandle.Free(); attachmentHandle.Free(); } }