public object GetValue(object key)
{
int position = ((IList<object>)this.keys).IndexOf(key);
if (position < 0)
if (this.parent != null)
return this.parent.GetValue(key);
else
throw new InvalidOperationException(string.Format("undefined key {0}", key));
return this.values[position];
}
public void CreateMap() { Map map = new Map(new object[] { new Atom("a"), new Atom("b") }, new object[] { 1, 2 }); Assert.AreEqual(1, map.GetValue(new Atom("a"))); Assert.AreEqual(2, map.GetValue(new Atom("b"))); }