I am trying to convert a hashtable to disctionary and found a a question here: convert HashTable to Dictionary in C#
public static Dictionary<K,V> HashtableToDictionary<K,V> (Hashtable table)
{
return table
.Cast<DictionaryEntry> ()
.ToDictionary (kvp => (K)kvp.Key, kvp => (V)kvp.Value);
}
When I try to use it, there is an error in table.Cast; intellisense does not show "Cast" as a valid method.