CoreWebView2Environment.CreateSharedBuffer(UInt64) Method


Create a shared memory based buffer with the specified size in bytes.

public Microsoft.Web.WebView2.Core.CoreWebView2SharedBuffer CreateSharedBuffer (ulong Size);
member this.CreateSharedBuffer : uint64 -> Microsoft.Web.WebView2.Core.CoreWebView2SharedBuffer
Public Function CreateSharedBuffer (Size As ULong) As CoreWebView2SharedBuffer





The buffer can be shared with web contents in WebView by calling PostSharedBufferToScript(CoreWebView2SharedBuffer, CoreWebView2SharedBufferAccess, String) or PostSharedBufferToScript(CoreWebView2SharedBuffer, CoreWebView2SharedBufferAccess, String). Once shared, the same content of the buffer will be accessible from both the app process and script in WebView. Modification to the content will be visible to all parties that have access to the buffer. The shared buffer is presented to the script as ArrayBuffer. All JavaScript APIs that work for ArrayBuffer including Atomics APIs can be used on it. There is currently a limitation that only size less than 2GB is supported.

Applies to