Jul-30-2021, 11:32 PM
I'm not sure your code demonstrates anything changing. Can you give more information on how this behavior was causing a problem? All I see above is that you've made NewVal1, NewVal2, and NewVal3 point to the same object. That shouldn't cause issues.
ints are immutable, so there is usually no benefit to trying to make some sort of independent copy of them. An int can never change. I wonder if your original problem wasn't that the ints were the same object but something else happening.
Can you show the part where the original value changed?
ints are immutable, so there is usually no benefit to trying to make some sort of independent copy of them. An int can never change. I wonder if your original problem wasn't that the ints were the same object but something else happening.
Can you show the part where the original value changed?