I need to sort a dictionary by value. I have the following code:
Code:
        public void Sort()
        {
            List<KeyValuePair<string, PluginDomain>> list = new List<KeyValuePair<string, PluginDomain>>(_domains);
            list.Sort(delegate(KeyValuePair<string, PluginDomain> a, KeyValuePair<string, PluginDomain> b)
            {
                return a.Value.Ordinal.CompareTo(b.Value.Ordinal);
            });
The problem with the above, is that it sorts the list just fine, how to I copy the contents of the list back to the dictionary?

Do I have to iterate through the list and add to the dictionary one object at a time or is there a better way?

Mike B