CSharp · Console
// C# Extension Method
// Doc: https://csharp-extension.com/en/method/1002681/idictionary-tohashtable
// @nuget: Z.ExtensionMethods
using System;
using System.Collections;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
var input = new Dictionary<string, string> {{"txt", "notepad.exe"}, {"bmp", "paint.exe"}, {"dib", "paint.exe"}, {"rtf", "wordpad.exe"}};
// C# Extension Method: IDictionary - ToHashtable
Hashtable result = input.ToHashtable(); // return Hashtable;
foreach (DictionaryEntry item in result)
{
Console.WriteLine("[{0}, {1}]", item.Key, item.Value);
}
}
}