AjErl.Language.Map.GetValue C# (CSharp) 메소드

GetValue() 공개 메소드

public GetValue ( object key ) : object
key object
리턴 object
        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];
        }

Usage Example

예제 #1
0
파일: MapTests.cs 프로젝트: ajlopez/AjErl
        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")));
        }
All Usage Examples Of AjErl.Language.Map::GetValue