Page 1 of 1

Out parametrers in User Code Action

Posted: Mon Aug 13, 2012 2:25 pm
by valentin
Is it possible to use out parameters in User Code Action?
I try

Code: Select all

        public void Set_Val(string Text, out string AccVal)
        {
        	 AccVal = Company_name + ";" + Contract_name + ";" + Text;
        }
When compiling I get error:
Argument 2 must be passed with the 'out' keyword (CS1620)
The best overloaded method match for 'Set_Val(string, out string)' has some invalid arguments (CS1502) piece of code:

Code: Select all

Set_Val("Text", Acc);

Re: Out parametrers in User Code Action

Posted: Mon Aug 13, 2012 2:46 pm
by Support Team
Hi,

You forgot to use the out keyword for the parameter:
Set_Val("Text", out Acc);
Here are some basic links about the topic:
Link1
Link2
Link3

Regards,
Markus
Ranorex Support Team

Re: Out parametrers in User Code Action

Posted: Mon Aug 13, 2012 2:59 pm
by valentin
Hi,

I don't forget ...

I wrote this code in Test.UserCode.cs

Code: Select all

        public void Set_Val(string Text, out string AccVal)
        {
            AccVal = Company_name + ";" + Contract_name + ";" + Text;
        }
Then I try to use Set_Val user action in Record Module Test.rxrec, Ranorex generate code Test.cs

Code: Select all

Set_Val("Text", Acc);
without keyword out
and raise an error.

Re: Out parametrers in User Code Action

Posted: Tue Aug 14, 2012 1:17 pm
by Support Team
Hi,

Ah okay sorry, now I got it ;).
This is not yet possible but I will add an issue to our internal system, meanwhile you have to set the specific variable within the method.

Regards,
Markus
Ranorex Support Team