It seems that are not any CopyTo and Sort functions in the Dictionary class that resides in the Systems.Collection.Generic namespace. The OrderBy extension method used by Linq is not very practical to me, because it does not return a dictionary object. Here is my extension method CopyTo, applicable to generic Dictionary objects, allowing to define a part of the dictionary: public static void CopyTo<T, V>(this Dictionary<T, V> source, Dictionary<T, V> target) { if (target == null) target = new Dictionary<T, V>(); foreach (KeyValuePair<T, V> entry in source) target.Add(entry.Key, entry.Value); } public static void CopyTo<T, V>(this Dictionary<T, V> source, Dictionary<T, V> target, int start) { if (target == null) target = new Dictionary<T, V>(); int iEntry = 0; foreach (KeyValuePair<T, V> entry in source) { if (iEntry++ >= start) target.Add(entry.Key, entry.Value); } } public static void CopyTo<T, V>(this Dicti...
Comments