I have a list of MyItems. MyItem may or may not refer to its peers.
List<MyItem> myList = new List<MyItem>(); myList.add(...)
I need to clone the entire list. Each MyItem in the new list is a new copy of MyItems in the old list (without reference), and all links in the new list should point to items in the new list. After that, the new list should work even with the old list, and the old MyItems are completely deleted.
I have an ICloneable interface in MyItem, so the element can be cloned by calling MyItem.Clone (). However, the cloned copy still refers to MyItems in the old list.
How to update MyItems links with objects in a new list? Sample code will be highly appreciated.
source share