Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pass By Reference in C#
#4
Hi Gintaras,
The example above works with integer type when I change to "string" type I've got an error of "Error in PassByRefStr: type mismatch."
You know what's wrong with it?
Macro PassByRefStr
Code:
Copy      Help
out
str s1="s1"
str s2="s2"
out "s1=%s, s2=%s" s1 s2
CsScript x.AddCode("")
IDispatch d=x.CreateObject("Test")
d.PassByRefStr(&s1 &s2)
err
,out _error.description
out "s1=%s, s2=%s" s1 s2

#ret
using System;

public class Test
{
,public static void PassByRefStr(ref string x, ref string y)
,{
,,x = "s1_string";
,,y = "s2_string";
,}
}


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)