Users Pricing

forum

Home Forums Hashtable to Dictionary – MindStick

Hashtable to Dictionary

Anonymous User 2914 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.

1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md