This is probably a really basic question – but I have a list of items (custom objects) being passed from one winform (.net 3.5) to another. I want to create a local list to store changes that only get persisted if the user clicks save. Currently if the user clicks cancel – the changes are still applied in the first form because I assume the objects are reference type.
I have the save working as it calls a service layer to do the save and then refreshes the other form – but not the cancel.
How do I create a new list from the first list where the objects act independently to the other list? (Hopefully this makes sense :))
Otherwise on cancel I’m going to have to rollback the changes which seems a less efficient way of handling the issue.
Thanks!
You would then have to clone all the entities in the list and add them to a new list.
Take a look at this post which has some info on cloning.