A params array is (broadly) syntactic sugar for a regular array, and
since arrays are reference types, if contents are edited in place the
values will remain edited to the caller; "ref" here would just allow
you to *reassign* the array, which isn't what you want.
Unfortunately you need to use regular array syntax to make this work,
but it can be done as below. However, my advice is to represent the
values in a class; this gives you far better context, i.e. you don't
have to remember that index 8 is the forename and should be a string -
you have a "string Forename" property.
object[] values = {3, "abc"};
SomeFunc(values );
object arg0 = values[0]; // will be 7
object arg1 = values[1]; // will be "Fred"
....
private void SomeFunc(object[] args) {// could be "params", but
doesn't help any
args[0] = 7;
args[1] = "Fred";
}
<ct*****@gmail. comwrote in message
news:11******** **************@ o11g2000prd.goo glegroups.com.. .
Thanks for your help..
Actually what i want to do is that communication between two class.
One is sending message with datas (serveral message)
The other is catching message and set variable with included message
from sender...
According to http://pobox.com/~skeet/csharp/parameters.html
Parameter arrays allow only variable number of arguments but I need
reference argument...
It there any other solution???
Please help me :=)