public static Dictionary<S, V> Clone<S,V>(Dictionary<S, V> dictionary)
{
Dictionary<S, V> cloneDictionary = new Dictionary<S, V>();
foreach (KeyValuePair<S, V> kvp in dictionary)
cloneDictionary.Add(kvp.Key, kvp.Value);
return cloneDictionary;
}
Tuesday, June 23, 2009
Generics Dictionary<> clone
Here's a simple routine that will clone generic Dictionary:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment