G
Guest
Hi
This is a sample code I am working on.
string a = "rb"
string b = a
Console.WriteLine(Object.ReferenceEquals(a,b))
In the above code, its printing true. I have a doubt on this output. When I say b = a, the system will create a new string called b and copy the value in a to b. Hence b and a should point to two new memory locations. Hence the output should be false, right
Can anybody clarify my doubt
Thanks
This is a sample code I am working on.
string a = "rb"
string b = a
Console.WriteLine(Object.ReferenceEquals(a,b))
In the above code, its printing true. I have a doubt on this output. When I say b = a, the system will create a new string called b and copy the value in a to b. Hence b and a should point to two new memory locations. Hence the output should be false, right
Can anybody clarify my doubt
Thanks