Out parametrers in User Code Action

Ask general questions here.
valentin
Posts: 27
Joined: Thu Nov 24, 2011 2:47 pm
Location: Moscow

Out parametrers in User Code Action

Post by valentin » Mon Aug 13, 2012 2:25 pm

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);

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Out parametrers in User Code Action

Post by Support Team » Mon Aug 13, 2012 2:46 pm

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

valentin
Posts: 27
Joined: Thu Nov 24, 2011 2:47 pm
Location: Moscow

Re: Out parametrers in User Code Action

Post by valentin » Mon Aug 13, 2012 2:59 pm

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.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Out parametrers in User Code Action

Post by Support Team » Tue Aug 14, 2012 1:17 pm

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