static IntPtr NewTake(byte[] data) { if (data == null) { throw new ArgumentNullException(nameof(data)); } var dataPtr = GMarshal.Alloc(data.Length); Marshal.Copy(data, 0, dataPtr, data.Length); var ret = g_byte_array_new_take(dataPtr, (ulong)data.Length); return(ret); }