I have a property that is held in model as a reference to the original component, from my list of components in an application. I've allowed the user to alter this property in a 'working' clone of the object. If they click confirm at the end of the alteration I want to replace the referenced original object directly so that it replaces it in the list that it was original located in.
Is this possible as currently I am simply replacing the relevant properties within the object as it stands.
Example:
Model.OriginalObject = [OriginalComponent];
Model.WorkingObject = [CloneOf][OriginalComponent];
//Interaction performed
Model.WorkingObject.Width = Example.Width;
//Original may not be available if a new component so replace properties only if it is available
if (Model.OriginalObject != null)
{
Model.OriginalObject = Model.WorkingObject; //This just replaces the reference
}
else
{
AddComponent(Model.WorkingObject);
}
edit: forgot to say WorkingComponent is a clone of the OriginalComponent