njsokalski
Well-known member
- Joined
- Mar 16, 2011
- Messages
- 102
- Programming Experience
- 5-10
This is probably going to sound like a question from somebody who just started programming last week, but since I have never really needed the answer before, I never bothered to figure it out. I have a Do loop that I want to exit once it goes through without making any changes to an object I created. I figured the best way to do this was to create a temporary copy of the object at the beginning of the loop and then compare that to the actual object at the end of the loop to determine whether any changes were made to it. The problem occurs when variables are accessed and copied by reference. I have tried to use some of the methods such as .Clone and .Equals (maybe I shouldn't be using these, but I didn't see any better built-in methods), but I seem to be doing some stuff wrong. Can somebody give me an example of a good way to copy an object for later equality testing, and how to do the equality testing? Thanks.