> > messsage. But in client program, this parameter is unchanged. Why? How
> > can I do?
[quoted text clipped - 10 lines]
>
> Blog: http://blogs.atozed.com/kudzu
> I think, when I pass a String Object to a function, the function can
> change its value, properties, these changes are made to the original
> object.
No.
private void Test(string x) {
x = "Hello";
}
private void button1_Click_1(object sender, System.EventArgs e) {
string y = "Bye";
Test(y);
button1.Text = y;
}
button1 says Byte, not Hello.
This makes it say Bye:
private void Test(ref string x) {
x = "Hello";
}
private void button1_Click_1(object sender, System.EventArgs e) {
string y = "Bye";
Test(ref y);
button1.Text = y;
}
> I have tried with "public bool xxx( ref String pMessage)", But it is the
> same result.
Webservices AFAIK dont support ref parameters. I think they support out
parameters though, you can try:
bool(string InString, out string OutString);
> I think, in this case, byref means, the function can change the
> reference to another String Object (in C++ is this corresp. to pointer,
> point to another object?)
Essentially.
> Otherwise, I understood, byval, in, out have meaning only with the
> primitive type.
No, its can effect objects too. Strings are immutable, so any change you
make makes a NEW string. So if you pass the object byval, there are now two
objects, and the first is not the same as the reference holder to the new
one.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Blog: http://blogs.atozed.com/kudzu
Martin - 19 May 2005 09:12 GMT
Thanks
> Webservices AFAIK dont support ref parameters. I think they support out
> parameters though, you can try:
>
> bool(string InString, out string OutString);
I had tried this way, before I asked newsgroup. But I call this method
false:
bool login(..., out string sMessage)
login(..., sMessage);
Now I wrote:
login(..., out sMessage);
Thanks again
> > I think, when I pass a String Object to a function, the function can
> > change its value, properties, these changes are made to the original
[quoted text clipped - 53 lines]
>
> Blog: http://blogs.atozed.com/kudzu