private void ApplyRemoveAt(int n_RemoveAt) { if (str_native.Length <= 0 || str_list.Count <= 0) { return; } if (n_RemoveAt <= 0) { return; } Assert.AreEqual(str_native.Length, str_list.Count); int i_range = str_native.Length; int n_remove = math.min(n_RemoveAt, i_range); Debug.Log("str_native.Capacity = " + str_native.Capacity.ToString() + ", str_native.Size = " + str_native.Size.ToString() + ", str_native.IndexCapacity = " + str_native.IndexCapacity.ToString() + ", str_native.Length = " + str_native.Length.ToString() + " (before remove)"); for (int i = 0; i < n_remove; i++) { int index = random.Next(0, i_range); StringEntity entity = str_native.At(index); ReadOnlyStringEntity entity_ro = entity.GetReadOnly(); //Debug.Log("delete: index = " + index.ToString()); str_native.RemoveAt(index); str_list.RemoveAt(index); i_range--; } Debug.Log("str_native.Capacity = " + str_native.Capacity.ToString() + ", str_native.Size = " + str_native.Size.ToString() + ", str_native.IndexCapacity = " + str_native.IndexCapacity.ToString() + ", str_native.Length = " + str_native.Length.ToString() + " (after remove)"); str_native.ReAdjustment(); Debug.Log("str_native.Capacity = " + str_native.Capacity.ToString() + ", str_native.Size = " + str_native.Size.ToString() + ", str_native.IndexCapacity = " + str_native.IndexCapacity.ToString() + ", str_native.Length = " + str_native.Length.ToString() + " (after call 'ReAdjustment()')"); str_native.ShrinkToFit(); Debug.Log("str_native.Capacity = " + str_native.Capacity.ToString() + ", str_native.Size = " + str_native.Size.ToString() + ", str_native.IndexCapacity = " + str_native.IndexCapacity.ToString() + ", str_native.Length = " + str_native.Length.ToString() + " (after call 'ShrinkToFit()')"); }