示例#1
0
        /// <summary>
        /// Copy contiguous len bytes from buf to view. fort can be 'C' or 'F' (for C-style or Fortran-style ordering).
        /// </summary>
        public void FromContiguous(IntPtr buf, long len, BufferOrderStyle fort)
        {
            if (disposedValue)
            {
                throw new ObjectDisposedException(nameof(PyBuffer));
            }
            if (Runtime.PyVersion < new Version(3, 7))
            {
                throw new NotSupportedException("FromContiguous requires at least Python 3.7");
            }

            if (Runtime.PyBuffer_FromContiguous(ref _view, buf, (IntPtr)len, OrderStyleToChar(fort, false)) < 0)
            {
                throw PythonException.ThrowLastAsClrException();
            }
        }