private void ApplyRemoveRange(int n_RemoveRange, int len_RemoveRange) { if (str_native.Length <= 0 || str_list.Count <= 0) { return; } if (n_RemoveRange <= 0 || len_RemoveRange <= 0) { return; } Assert.AreEqual(str_native.Length, str_list.Count); int i_range = str_native.Length; int n_remove = math.min(n_RemoveRange, i_range / len_RemoveRange); Debug.Log("str_native.Capacity = " + str_native.Capacity.ToString() + ", str_native.Size = " + str_native.Size.ToString() + " (before remove)"); for (int i = 0; i < n_remove; i++) { int index = random.Next(0, i_range - len_RemoveRange); str_native.RemoveRange(index, len_RemoveRange); str_list.RemoveRange(index, len_RemoveRange); i_range -= len_RemoveRange; } 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()')"); }