Esempio n. 1
0
        /// <summary>
        /// Converts this instance to a read only typed buffer.
        /// </summary>
        /// <typeparam name="T">Type of a buffer element</typeparam>
        /// <returns>A readonly typed buffer.</returns>
        /// <exception cref="System.InvalidOperationException">DataPointer is Zero</exception>
        public                             T[] ToArray <T>() where T : struct
        {
            if (Pointer == IntPtr.Zero)
            {
                throw new InvalidOperationException("DataPointer is Zero");
            }
            var buffer = new T[Size / SdxUtilities.SizeOf <T>()];

            CopyTo(buffer, 0, buffer.Length);
            return(buffer);
        }