O
Ori
Hi,
I have a simple question.
Let say that i have 3 functions as following
private main()
{
Object oTop = new Object();
}
private void A(ref Object obj)
{
B(obj)
}
private void B(Object obj)
{
obj = "1";
}
Does the function B receive the same reference to the object "oTop"
(as A) or it receive a copy of the reference?
What is the best way to keep using the same reference between those
functions? Do i need to add a ref to the B function and make it like
this:
private void B(ref Object obj)
{
obj = "1";
}
Please help me in this point. I'm looking to find the most efficient
why to keep with the reference propogation ( i need a reference
because i update the object).
Thanks.
I have a simple question.
Let say that i have 3 functions as following
private main()
{
Object oTop = new Object();
}
private void A(ref Object obj)
{
B(obj)
}
private void B(Object obj)
{
obj = "1";
}
Does the function B receive the same reference to the object "oTop"
(as A) or it receive a copy of the reference?
What is the best way to keep using the same reference between those
functions? Do i need to add a ref to the B function and make it like
this:
private void B(ref Object obj)
{
obj = "1";
}
Please help me in this point. I'm looking to find the most efficient
why to keep with the reference propogation ( i need a reference
because i update the object).
Thanks.