Exemplo n.º 1
0
        public NestedDictionary <TKey, TValue> this[TKey key, params TKey[] sections]
        {
            get
            {
                NestedDictionary <TKey, TValue> dict = this;

                if (sections.Length <= 0)
                {
                    return(dict[key]);
                }

                dict = sections.Aggregate(dict, (current, section) => current[section]);

                return(dict[key]);
            }
            set
            {
                NestedDictionary <TKey, TValue> dict = this;

                if (sections.Length <= 0)
                {
                    dict[key] = value;
                }

                dict = sections.Aggregate(dict, (current, section) => current[section]);

                dict[key] = value;
            }
        }
Exemplo n.º 2
0
        public new NestedDictionary <TKey, TValue> this[TKey key]
        {
            get
            {
                if (!Keys.Contains(key))
                {
                    base[key] = new NestedDictionary <TKey, TValue>();
                }

                return(base[key]);
            }
            set
            {
                base[key] = value;
            }
        }