Exemple #1
0
        public void ReadArray <T> (ulong byteOffset, T[] array, int index, int count) where T : struct
        {
            if (!inited)
            {
                throw new InvalidOperationException();
            }

            unsafe {
                int   size   = Marshal.SizeOf(typeof(T)) * count;
                byte *source = (((byte *)handle) + byteOffset);
                if (source >= last_byte || source + size > last_byte)
                {
                    throw new ArgumentException("byteOffset");
                }

                Marshal.copy_from_unmanaged((IntPtr)source, index, array, count);
            }
        }