示例#1
0
        public override bool TryGetMember(GetMemberBinder binder, out object result)
        {
            JToken value;

            if (o.TryGetValue(binder.Name, out value))
            {
                result = DynamicJsonHelper.GetDynamicValue(value);
                return(true);
            }
            result = null;
            return(false);
        }
示例#2
0
        public override bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result)
        {
            var i = (int)indexes[0];

            if (i < 0 || i > array.Count)
            {
                result = null;
            }
            else
            {
                var item = array[i];
                result = DynamicJsonHelper.GetDynamicValue(item);
            }
            return(true);
        }