/// <summary>Insert an item into the array at a given index</summary>
        /// <param name="array">The array</param>
        /// <param name="itemToInsert">The item to insert</param>
        /// <param name="index">The index to insert the item at</param>
        /// <returns>`true` if successful</returns>
        public static bool ATGenericArrayInsertItem(Foundation.ATGenericArrayUnsafe array, IntPtr itemToInsert, ulong index)
        {
            var _arg0 = ReferenceEquals(array, null) ? IntPtr.Zero : array._Instance;
            var _ret  = _Internal.ATGenericArrayInsertItem(_arg0, itemToInsert, index);

            return(_ret);
        }
        /// <summary>Remove all items</summary>
        /// <param name="array">The array</param>
        /// <returns>`true` if successful</returns>
        /// <remarks>Will not zero out items removed</remarks>
        public static bool ATGenericArrayRemoveAllItems(Foundation.ATGenericArrayUnsafe array)
        {
            var _arg0 = ReferenceEquals(array, null) ? IntPtr.Zero : array._Instance;
            var _ret  = _Internal.ATGenericArrayRemoveAllItems(_arg0);

            return(_ret);
        }
        /// <summary>Append an item to the array</summary>
        /// <param name="array">The array</param>
        /// <param name="itemToAppend">A pointer to the item to append</param>
        /// <returns>`true` if successful</returns>
        public static bool ATGenericArrayAppendItem(Foundation.ATGenericArrayUnsafe array, IntPtr itemToAppend)
        {
            var _arg0 = ReferenceEquals(array, null) ? IntPtr.Zero : array._Instance;
            var _ret  = _Internal.ATGenericArrayAppendItem(_arg0, itemToAppend);

            return(_ret);
        }
        /// <summary>Get a pointer to an item in the array</summary>
        /// <param name="array">The array</param>
        /// <param name="index">The index of the item to retrieve</param>
        /// <returns>A pointer to the item</returns>
        public static IntPtr ATGenericArrayGetPointerForItem(Foundation.ATGenericArrayUnsafe array, ulong index)
        {
            var _arg0 = ReferenceEquals(array, null) ? IntPtr.Zero : array._Instance;
            var _ret  = _Internal.ATGenericArrayGetPointerForItem(_arg0, index);

            return(_ret);
        }
 public ATGenericArrayUnsafe(Foundation.ATGenericArrayUnsafe _0)
 {
     _Instance                     = Marshal.AllocHGlobal(sizeof(Foundation.ATGenericArrayUnsafe._Internal));
     _ownsNativeInstance           = true;
     NativeToManagedMap[_Instance] = this;
     *((Foundation.ATGenericArrayUnsafe._Internal *)_Instance) = *((Foundation.ATGenericArrayUnsafe._Internal *)_0._Instance);
 }
        /// <summary>Determine if two arrays are equal</summary>
        /// <param name="array1">The first array</param>
        /// <param name="array2">The second array</param>
        /// <returns>`true` if the arrays are equal (the contents of the array are equal)</returns>
        public static bool ATGenericArrayIsEqual(Foundation.ATGenericArrayUnsafe array1, Foundation.ATGenericArrayUnsafe array2)
        {
            var _arg0 = ReferenceEquals(array1, null) ? IntPtr.Zero : array1._Instance;
            var _arg1 = ReferenceEquals(array2, null) ? IntPtr.Zero : array2._Instance;
            var _ret  = _Internal.ATGenericArrayIsEqual(_arg0, _arg1);

            return(_ret);
        }
        /// <summary>Copy an array. Will attempt to resize destination if destination capacity is less than source length</summary>
        /// <param name="destination">The destination array</param>
        /// <param name="source">The source array</param>
        /// <returns>`true` if successful</returns>
        public static bool ATGenericArrayCopy(Foundation.ATGenericArrayUnsafe destination, Foundation.ATGenericArrayUnsafe source)
        {
            var _arg0 = ReferenceEquals(destination, null) ? IntPtr.Zero : destination._Instance;
            var _arg1 = ReferenceEquals(source, null) ? IntPtr.Zero : source._Instance;
            var _ret  = _Internal.ATGenericArrayCopy(_arg0, _arg1);

            return(_ret);
        }
        /// <summary>Initialize a new generic array object from existing data</summary>
        /// <param name="array">The object to initialize. Can be `NULL` so the result from `ATGenericArrayNew` can be passed directly, in which case it will simply return `NULL`</param>
        /// <param name="existingData">The existing data to copy from</param>
        /// <param name="length">The length of the existing data (number of items)</param>
        /// <param name="bytesPerItem">The number of bytes per item</param>
        /// <returns>The initialized object or `NULL` if initialization failed</returns>
        public static Foundation.ATGenericArrayUnsafe ATGenericArrayInitWithItems(Foundation.ATGenericArrayUnsafe array, IntPtr existingData, ulong length, ulong bytesPerItem)
        {
            var _arg0 = ReferenceEquals(array, null) ? IntPtr.Zero : array._Instance;
            var _ret  = _Internal.ATGenericArrayInitWithItems(_arg0, existingData, length, bytesPerItem);

            Foundation.ATGenericArrayUnsafe _result0;
            if (_ret == IntPtr.Zero)
            {
                _result0 = null;
            }
            else if (Foundation.ATGenericArrayUnsafe.NativeToManagedMap.ContainsKey(_ret))
            {
                _result0 = (Foundation.ATGenericArrayUnsafe)Foundation.ATGenericArrayUnsafe.NativeToManagedMap[_ret];
            }
            else
            {
                _result0 = Foundation.ATGenericArrayUnsafe._CreateInstance(_ret);
            }
            return(_result0);
        }
        /// <summary>Create a new generic array object</summary>
        /// <param name="optionalStorage">Optionally, a pointer to a struct or memory where the object can be stored</param>
        /// <returns>A pointer to the new object. `NULL` if allocation could not be completed</returns>
        public static Foundation.ATGenericArrayUnsafe ATGenericArrayNew(Foundation.ATGenericArrayUnsafe optionalStorage)
        {
            var _arg0 = ReferenceEquals(optionalStorage, null) ? IntPtr.Zero : optionalStorage._Instance;
            var _ret  = _Internal.ATGenericArrayNew(_arg0);

            Foundation.ATGenericArrayUnsafe _result0;
            if (_ret == IntPtr.Zero)
            {
                _result0 = null;
            }
            else if (Foundation.ATGenericArrayUnsafe.NativeToManagedMap.ContainsKey(_ret))
            {
                _result0 = (Foundation.ATGenericArrayUnsafe)Foundation.ATGenericArrayUnsafe.NativeToManagedMap[_ret];
            }
            else
            {
                _result0 = Foundation.ATGenericArrayUnsafe._CreateInstance(_ret);
            }
            return(_result0);
        }