Help for filling an empty variable in an array

Good morning, I have an error that registers when I want to fill an empty variable with an array, I get the following error:
Append Item to List: Collection was of a fixed size. UiPath

Try Array.Empty instead of New String(){}

Hi @Estefania_Elena_Medina_Or ,

I believe with Arrays we will not be able to modify the instance or the Array variable directly as it is of a fixed size and therefore we cannot add/delete elements directly. But work around or what we usually use is re-create/re-assign the filtered/modified array back to the same array variable.

For the addition of Elements :

yourArray = yourArray.Append("D").ToArray

From Debug :

Alternately, if you would require to use Append items to List, you could create a List type variable and use the activity, as we can directly Append items to a List.

Instead you can first create a list variable and then convert that to array if you want as you can add any number of values to a list without redefining

Use a assign activity like this

Listvar = New List(of String)

Where Listvar is a variable of type systems.Collections.Generic.List(of String)

Now u can use APPEND ITEM TO LIST activity and add n number of value u want

Once after adding use a assign activity like this to simply convert to an array

arrvar = Listvar.ToArray()

Hope this helps

Cheers @Estefania_Elena_Medina_Or