forum

Home / DeveloperSection / Forums / Hashtable to Dictionary

Hashtable to Dictionary

Anonymous User 2484 17-Dec-2013

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.

c# c# 
Updated on 17-Dec-2013
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By