The orderedDictionary instantiation is this:
IOrderedDictionary orderedDictionary= gridview.DataKeys[index].Values;
orderedDictionary is read only.
How can I make a deep copy of orderedDictionary that is not read only? Serialization/deserialization doesn't work cause it also copies the read only part.
The easiest way would be to just copy the objects:
UPDATE:
This code will NOT create a deep copy of the values in the dictionary.
Example:
Both dictionary will contain one entry with the key "1" and the same list. Removing an item from this list in any of the dictionaries will also change the contents of the list in the other dictionary, because there only IS one list.
This will output the following:
Assigning a new value to a key in one of the dictionary however has no effect on the other dictionary:
This will output: