MyObject first = new MyObject();
first.value = 4;
second = first;
second.value = 5;
Console.WriteLine(first.value);
I get 4. Is there a way to get 5 by only modifying second?
MyObject first = new MyObject();
first.value = 4;
second = first;
second.value = 5;
Console.WriteLine(first.value);
I get 4. Is there a way to get 5 by only modifying second?
you can't except you turn into using Singleton pattern
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.