using System.Collections;
using System.Collections.Generic;
public static void Main()
var dic = new DuplicateKeyDictionary();
dic.Add("Key2", "test2");
dic.Add("Key3", "test3");
dic.Add("Key1", "test4");
Console.WriteLine($"{item}");
public class DuplicateKeyDictionary : IEnumerable
private List<object> keys = new List<object>();
private List<object> values = new List<object>();
public void Add(object key, object value)
public IEnumerator GetEnumerator()
for (int i = 0; i < keys.Count; i++)
yield return new KeyValuePair<object, object>(keys[i], values[i]);
public object this[object key]
for (int i = 0; i < keys.Count; i++)