Wednesday, 4 September 2013

Original Values changes are not reflecting in reference types varaiable in C#

Original Values changes are not reflecting in reference types varaiable in C#

please help on this
object a = "1411";
object b = a;
Console.WriteLine("Before Value of a " + a);
Console.WriteLine("Before Value of b " + b);
a = "5555";
Console.WriteLine("After Value of a " + a);
Console.WriteLine("After Value of b " + b);
Console.ReadKey();
output :
Before Value of a 1411
Before Value of b 1411
After Value of a 5555
After Value of b 1411
After Value of b also should changed to 5555 right ? since b is reference
types varaiable.

No comments:

Post a Comment