Beispiel #1
0
        public IDictionaryTreeNode <TKey, TValue> GetChildSection(IEnumerable <TKey> sections)
        {
            if (sections is null)
            {
                return(null);
            }

            IDictionaryTreeNode <TKey, TValue> node = Node;

            return(sections.WhereNotNull().Any(section => !node.TryGetValue(section, out node)) ? null : node);
        }
Beispiel #2
0
        public IDictionaryTreeNode <TKey, TValue> GetChild(TKey key, IEnumerable <TKey> sections)
        {
            if (key is null)
            {
                throw new ArgumentNullException(nameof(key));
            }

            IDictionaryTreeNode <TKey, TValue> node = GetChildSection(sections);

            if (node is null)
            {
                return(null);
            }

            node.TryGetValue(key, out IDictionaryTreeNode <TKey, TValue> value);
            return(value);
        }