public bool TryGetValue(string name, out object value)
        {
            var found = _dictionary.TryGetValue(name, out value);

            if (found)
            {
                if (value is IDictionary <string, object> )
                {
                    value = new DictionaryObjectValueProvider((IDictionary <string, object>)value);
                }

                if (value is object[])
                {
                    value = new ObjectArrayValueProvider((object[])value);
                }
            }

            return(found);
        }
예제 #2
0
        public bool TryGetValue(int index, out object value)
        {
            if (index < 0 || index >= _values.Length)
            {
                value = null;
                return(false);
            }

            value = _values[index];
            if (value is IDictionary <string, object> )
            {
                value = new DictionaryObjectValueProvider((IDictionary <string, object>)value);
            }
            else if (value is object[])
            {
                value = new ObjectArrayValueProvider((object[])value);
            }

            return(true);
        }
        public bool TryGetValue(int index, out object value)
        {
            if (index < 0 || index >= _values.Length)
            {
                value = null;
                return(false);
            }

            value = _values.GetValue(index);
            if (value is IDictionary <string, object> dict)
            {
                value = new DictionaryObjectValueProvider(dict);
            }
            else if (value is Array arr)
            {
                value = new ObjectArrayValueProvider(arr);
            }

            return(true);
        }