using System.Collections;
using System.Collections.Generic;
public static void Main()
var keyList = new int[]{1,2,3,4,5};
IDictionary<int,string> resultDict = new FakeFastDictionary<int,string>();
foreach (var key in keyList)
resultDict.Add(key, "someResult");
foreach (var key in resultDict.Keys)
Console.WriteLine((key));
foreach (var value in resultDict.Values)
Console.WriteLine((value));
public class FakeFastDictionary<TKey, TValue> : Dictionary<TKey, TValue>
protected IList<KeyValuePair<TKey, TValue>> _list
= new List<KeyValuePair<TKey, TValue>>();
public new void Add(TKey key, TValue value)
_list.Add(new KeyValuePair<TKey, TValue>(key, value));
public new ICollection<TValue> Values
return _list.Select(x => x.Value).ToArray();
public new ICollection<TKey> Keys
return _list.Select(x => x.Key).ToArray();