public static unsafe void PopulateListFromArray <T>(SystemBase system, NativeArray <ComponentType> componentTypes, bool readOnly, ref T list)
            where T : struct, IDynamicTypeList
        {
#if ENABLE_UNITY_COLLECTIONS_CHECKS
            if (UnsafeUtility.SizeOf <ArchetypeChunkComponentTypeDynamic8>() != UnsafeUtility.SizeOf <DynamicComponentTypeHandle>() * 8)
            {
                throw new System.Exception("Invalid type size, this will cause undefined behavior");
            }
#endif

            DynamicComponentTypeHandle *componentTypesPtr = list.GetData();
            list.Length = componentTypes.Length;
            for (int i = 0; i < list.Length; ++i)
            {
                var compType = componentTypes[i];
                if (readOnly)
                {
                    compType.AccessModeType = ComponentType.AccessMode.ReadOnly;
                }
                componentTypesPtr[i] = system.GetDynamicComponentTypeHandle(compType);
            }
        }
        public static unsafe void PopulateList <T>(SystemBase system, DynamicBuffer <GhostCollectionComponentType> ghostComponentCollection, bool readOnly, ref T list)
            where T : struct, IDynamicTypeList
        {
#if ENABLE_UNITY_COLLECTIONS_CHECKS
            if (UnsafeUtility.SizeOf <ArchetypeChunkComponentTypeDynamic32>() != UnsafeUtility.SizeOf <DynamicComponentTypeHandle>() * 32)
            {
                throw new System.Exception("Invalid type size, this will cause undefined behavior");
            }
#endif
            var listLength = ghostComponentCollection.Length;
            DynamicComponentTypeHandle *GhostChunkComponentTypesPtr = list.GetData();
            list.Length = listLength;
            for (int i = 0; i < list.Length; ++i)
            {
                var compType = ghostComponentCollection[i].Type;
                if (readOnly)
                {
                    compType.AccessModeType = ComponentType.AccessMode.ReadOnly;
                }
                GhostChunkComponentTypesPtr[i] = system.GetDynamicComponentTypeHandle(compType);
            }
        }