I’m trying to copy a list to a list, but it keeps copying it by reference, so a change in one changes the other. I tried cloning but it didn’t copy the parent- child relationship.
foreach (TreeNode item in listNodesdestination)
testNode1.Add((TreeNode)item.Clone());
thanks.
Since it is serializable, you could perform a deep copy using a memory stream.
deep copy via memory stream – stack overflow