ColdFusion – Creating Copy of a Structure Using CFSet, Duplicate and Structcopy
Using CFSet
Creating a copy of a Structure using CFSet will result in a new variable having a reference to the original Structure;
changes will affect the original Structure.
******************************************************
Using Duplicate
Creating a copy of a Structure using Duplicate will result in a new variable containing no reference to the original Structure but rather a snapshot of its current contents.
changes will NOT affect the original Structure.
******************************************************
Using Strcutcopy
Strcutcopy is where most people get confused.
We can say Structcopy is between CFSet and Duplicate.
When we use Structcopy, a new structure will be created; however, references to nested structures, objects, and query variables will be maintained from the original Structure.
changes will affect the original Structure.
******************************************************