Can change size of an array when the game is running?

Can change size of an array when the game is running?
when I want to do this it always says that it’s read only ,is there anyone to change size of an array via code?

Hi.) You can create only a new array or use the List collection

Yes, Check
Array.Resize: Array.Resize<T>(T[], Int32) Method (System) | Microsoft Learn

Create new class Named “Extensions”
Extensions.cs

namespace Assets
{
    using System.Collections.Generic;
    using System.Linq;

    public static class Extensions
    {
        public static void Append<T>(this IEnumerable<T> array, T value, ref T[] arrayToExtend)
        {
           List<T> list = array.ToList();
            list.Add(value);
            arrayToExtend = list.ToArray();
        }
    }
}

Usage :

GameObject newGameObject = new GameObject();
someObjects.Append(newGameObject, ref someObjects);