102
1
using System;
2
using System.Collections;
3
using System.Collections.Generic;
4
using System.Diagnostics;
5
6
public class Program
7
{
8
private const int NumberInsertedKeys = 5000;
9
public static Hashtable hTable = new Hashtable();
10
public static Dictionary<int, string> dict = new Dictionary<int, string>();
11
public static decimal MemoryUsed;
12
public static decimal DictionaryMemoryUsed;
13
public static decimal HashtableMemoryUsed;
14
public static Stopwatch watch = new Stopwatch();
15
public static void Main()
16
{
17
Console.WriteLine("Dictionary VS Hashtable");
18
MemoryUsed = System.GC.GetTotalMemory(true) / 1024;
19
Msg("Started with this: {0:N0} KB", MemoryUsed);
20
21
DictionaryTest();
22
HashtableTest();
23
CollectMemory();
24
}
Cached Result