ソースコード
using System.Collections; using System.Collections.Generic; /// <summary> /// Dictionary 型の拡張メソッドを管理するクラス /// </summary> public static class DictionaryExtensions { /// <summary> /// 指定された Dictionary<TKey, TValue> を Hashtable に変換します /// </summary> /// <param name="self">Dictionary<TKey, TValue> 型のインスタンス</param> /// <returns>Hashtable 型のインスタンス</returns> public static Hashtable ToHashtable<TKey, TValue>( this Dictionary<TKey, TValue> self ) { var result = new Hashtable(); foreach ( var n in self ) { result[ n.Key ] = n.Value; } return result; } }