Error in Assigning Array Variables in C#

Hello,
I tried to implement the array variables code from https://docs.uipath.com/studio/docs/array-variables given in VB in C# but getting an error in assigning values to the String array.

Getting the below error:

RemoteException wrapping System.InvalidOperationException: Compilation failures occurred: 

; expected	Invalid expression term ','	; expected	; expected	Invalid expression term ','	; expected	; expected	Invalid expression term '{'	; expected	; expected	Invalid expression term ','	; expected	; expected	Invalid expression term ','	; expected	; expected

Complete results are contained in the Data property of this exception. Please correct the errors in the source and retry the Load.
at System.Activities.XamlIntegration.ActivityXamlServices.Compile(IDynamicActivity dynamicActivity, LocationReferenceEnvironment environment)
at System.Activities.XamlIntegration.ActivityXamlServices.Load(XamlReader xamlReader, ActivityXamlServicesSettings settings)
at System.Activities.XamlIntegration.ActivityXamlServices.Load(XmlReader xmlReader, ActivityXamlServicesSettings settings)
at System.Activities.XamlIntegration.ActivityXamlServices.Load(Stream stream, ActivityXamlServicesSettings settings)
at UiPath.Executor.WorkflowRuntime.Load(String workflowFile)
at UiPath.Executor.RobotRunner.InitWorkflowApplication()
at UiPath.Executor.RobotRunner.d__76.MoveNext()

Thanks in advance!

1 Like

Hi
Welcome to uipath community
Fine instead of array kindly use List variable
System.Collections.Generic.List(of String)
With default value as New list(of string) defined in the variable panel

Now in the write text file while mentioning the list variable mention like this
NameAge(0) + ā€œ ā€œ + NameAge(1)ā€¦ like this with curve bracket

Hope this would help you
Cheers @rajeshdixit

Hi @Palaniyappan,

Thanks for your help. However, Iā€™m still facing an error. It will be really nice of you if can help me out.
Iā€™m attaching the error messages in screenshots.

1 Like

you were almost done
it would be like this

kindly create a new variable in the variable panel and try once
Cheers @rajeshdixit

Hi @Palaniyappan,

This solved the error. Thanks for all your help.

image

Great
we can either define the default value in variable panel or in the assign activity for a list variable
either of this will work
Cheers @rajeshdixit