Issue in getting value from 'Out' parameter

I have created a process using language as ‘C#’. In the workflow i have assigned boolResult = int.TryParse(“45”, out intResult). Here boolResult is the bool type variable and intResult is the int type variable. When i try to print intResult in the Log activity, the output i am getting is 0 not 45.Pls find attached below image

.

Same expression in visual studio is working fine


in ‘io’ variable i am getting the correct output which is 45.

Please clarify

Thanks in advance

@raja.raviraj
when using the Assign Activity the parsed value is not forwarded to the out variable.
We can use the invoke method activity instead for this method call

Thanks for the reply.

I tried to use the invoke method but getting below error

Target type will accept ‘struct’ in this case? please find screenshot of the tryparse method signature and its struct

Hi @sangeethaneelavannan1

Instead of using
→ int.tryparse(“45”,outintResult)

use this Expression to get better
->Int32.TryParse(“45”,outintResult)

Thanks,
Harivishnu

it will look like this:
grafik

1 Like

Assign intResult = CInt(“45”)

Why are you trying to assign the result to a boolean?

Bingo It works!!! Thanks for the solution

I don’t see any difference. Both pointing to the same TryParse method in the C# library.Please correct me if i am wrong

Its C# tryparse method, which gives ‘True’ if the input value is int otherwise false without throwing any error, at the same time it will give the value itself in another variable.

1 Like

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