Fetching Sorted Keys from a Hashtable

Here's a quick and dirty way to retrieve the keys of a hashtable (or generic Dictionary in this case) as a sorted list:
...

public static List<K> GetSortedKeys<K, V>(Dictionary<K, V> table)
{
   List<K> sortedKeys = new List<K>();

   foreach (K key in table.Keys)
   {
      int locIndex = sortedKeys.BinarySearch(key);

      Debug.Assert(locIndex < 0);

      sortedKeys.Insert(~locIndex, key);
   } // foreach

   return sortedKeys;
}

...