Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Save original object before make changes
Message
From
17/11/2012 01:06:25
 
 
To
14/11/2012 16:55:26
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
Environment:
VB 9.0
OS:
Windows XP SP2
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01557223
Message ID:
01557500
Views:
52
Likes (1)
One way to handle it is to create a method in your client class, kind of like a combination of what both Naomi and Pete mentioned. You could call the method .Clone() (there is no built in .Clone() method for a class). Have your .Clone() method create a new instance of your client class, set all the properties of the new instance to the properties of itself, then return the new instance.

~~Bonnie


>I have an instance of a client object whose values/properties I'm going to change and use to update a record in a database. But I want to save the original values/properties before I make any changes for reference later as the "original" object.
>
>
>dim origClient as new client
>origClient = client
>
>
>Then I make changes to client object.
>
>But as I'm making changes to the client object they are showing up in the origClient object as well, defeating its "save" purpose.
>
>How do I do this correctly? Thanks.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform