I have 2 object of same class as following in c#.
Myclass obj1 = new Myclass();
Myclass obj2 = null;
obj2 = obj1;
obj1.Name = "abc"; //"abc" will also assign to obj2.Name.
When I assign obj1.Name="abc"
, it will also assign to obj2.Name
. I want to stop this. I have tried by const, sealed but I am not getting result.
Can anybody suggest me how to stop reference of obj1
on obj2
?