Need help with error 'string[]' does not contain a definition for 'Concat'

While going through the UiPath course came to a practice session wherein I was required to do some actions(Please refer to attached image)

. So while trying to concatenate to the string arrays i failed to do so using C#(Attached Image)

I can run using Thus need help with proper syntax what should be done so that it works using C#.
I tried append() as well but got another error.

Main.xaml (11.7 KB)


As a workaround you can convert an array to list, add as many items as you need and then eventually convert it back to the Array.

Array to list:
yourList = yourArray.ToList()

List to Array:
yourArray = yourList.ToArray()

Then You can use add to collections activity you want to add value to an list or any collections

Cheers @AB27

1 Like

Hi @AB27 ,

This seems like a very odd issue.


I don’t seem to face it from my end, I’ll do some more R&D and get back to you.
Could you try the syntax like I have?


Kind Regards,
Ashwin A.K

Hi @AB27 ,

If you are trying to concatenate an Array to an Array, we could use Concat with array value as the second.

But if we are trying to add a Single item , in your case a String value, we can use Append instead of Concat.

Also, there is no need of semi colon at the end in an Assign Activity

Using Concat :

ErrorAX.Concat(new String[]{item}).ToArray()

Using Append :

1 Like

I tried with both, the error went away but the first assign is giving error now, Concat() and append() both have same error that the value is null.

I have the values in for loop so can’t identify and add individual elements to it.
Maybe I’m doing something wrong.

Hi @AB27 ,

The Error is due to the ErrorAX not being initialised with an Empty String[].

We can intialise it as a Default value

new String[]{}

Similarly we would also have to initialise other String array variables which are in use.

Oops I missed that got it, Thank you for all your help and quick responses.
Have a great day ahead! @supermanPunch

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.