Point To String Variable Reference

Hi, I would like to assign a string variable with another string variable’s reference, so that when I assign another value to either one of them, both value will be the same. Is it possible to do it?

Thanks.

Hi,

String class in .net is reference type. However, it behaves as if Value type. So, I think it’s difficult to pass its reference to another variable in easy way.

How about using other reference type such as String[], as the following?

Regards,

Thanks. This is very helpful, I can use this. However, to prevent unexpected error, I would like to keep the first variable as string. Thanks

Regards.

HI @azeem_rosli

Try like this

  • Create two variables for eg : Samp1,Samp2
  • Assign Samp2=“Something”
  • If Samp1 is Nothing
    True-> Assign Samp1 = Samp2
    Else-> Assign Samp2=Samp1
    image

By this whatever the value is assigned will be in the both variable


Hope this is what you are asking and this helps

Regards
Sudharsan

Thanks @Sudharsan_Ka ,

As you can see above, I have a few string variables, each of them will undergo similar process (I can use invoke workflow instead), I don’t want to duplicate the invoke workflow, instead I would like to iterate them with for each maybe. If it’s not possible, I think @Yoichi’s solution is quite better.

Regards.