/// <inheritdoc/>
        public override long Seek(long offset, SeekOrigin origin)
        {
            long newPosition;

            if (!NativeFile.SetFilePointerEx(handle, offset, out newPosition, origin))
            {
                throw new IOException("Unable to seek to this position", MarshalGetLastWin32Error());
            }
            position = newPosition;
            return(position);
        }
        /// <inheritdoc/>
        public override void SetLength(long value)
        {
            long newPosition;

            if (!NativeFile.SetFilePointerEx(handle, value, out newPosition, SeekOrigin.Begin))
            {
                throw new IOException("Unable to seek to this position", MarshalGetLastWin32Error());
            }
            if (!NativeFile.SetEndOfFile(handle))
            {
                throw new IOException("Unable to set the new length", MarshalGetLastWin32Error());
            }

            if (position < value)
            {
                Seek(position, SeekOrigin.Begin);
            }
            else
            {
                Seek(0, SeekOrigin.End);
            }
        }