I think there is a shorter way of writing this foreach loop that creates a deep copy of a SortedDictionary<string, object>. Note that object is just a place holder, I’m really using some other reference type there. Thanks!
Here is the code:
foreach (KeyValuePair<string, object> entry in sortedDictionary)
{
this.mSortedDictionary.Add(entry.Key, new object());
}
Whats the point, this is perfectly short.
And for the record, you can make an extension method for Dictioary (or IDictioary) that does this. From then on, you can call the extension method on any dictioary.