int a;
static void Main(string[] args)
{
Value v1 = new Value();
v1.a = 10;
Value v2 = v1; // this statement copies value from v1 to v2.
Console.WriteLine(v1.a); // here the value is 10
Console.WriteLine(v2.a); // here the value is 10
v1.a = 20; // here the v1.a value is changed.
Console.WriteLine(v1.a); // here the value is 20
Console.WriteLine(v2.a); // here the value is 10
}
Posted by:
T.saravanan
on: 2/20/2011
Level:Silver | Status: [Member] [MVP] | Points: 10
Hi,
doubts in your code...
1.Are you using 4.0 framework because i will try this code in 3.5 framework i am not get Value (Value v1 = new Value();) object in this framework.
2.In v1.a... what is 'a'
Kindly clarify those doubts to me...
This is in .NET 4.0
Here 'a' is a variable and I am assigning the value to that variable with the help of Value object.
Posted by:
T.saravanan
on: 2/21/2011
Level:Silver | Status: [Member] [MVP] | Points: 10
Ok.Thanks,
But you did not assign the Variable 'a' .
Kindly checked it out and change it.
Now I have changed.
Please check it out.
Thanks T.saravanan.
Regards,
Tripati