Passing Array as UserCode Argument

Class library usage, coding and language questions.
pleugene
Posts: 3
Joined: Thu May 07, 2015 7:46 pm

Passing Array as UserCode Argument

Post by pleugene » Sat Jun 13, 2015 1:05 am

Instead of adding the same user code function multiple times with different variables, is it possible to pass a single array argument into the function (string, int) since Ranorex default argument in the Recording UI does not have array as an argument type option.

For example, I have a validation function that validate whether multiple strings of data exist on the page. Currently I'm having to repeat the validation step twice to check two different string.

Validate_String(string var);

Wondering if there's any way to do something like :

Validate_String(string[] var);

Thanks!!
Eugene

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Passing Array as UserCode Argument

Post by Support Team » Mon Jun 15, 2015 8:19 am

Hello Eugene,

Following data types are available for recording variables:
PossibleDataTypes.png
PossibleDataTypes.png (2.46 KiB) Viewed 1491 times
Unfortunately, it’s not possible to use an array as an argument for UserCode methods, which should be addressable from recordings.

I would suggest passing the strings separately to your method. For example:
public void MyUserCodeMethod(string argument1, string argument2)
        {
        }
Regards,
Robert
.
Image