Open.Core.TreeNode.FromDictionary C# (CSharp) Method

FromDictionary() private static method

private static FromDictionary ( System.Collections.Dictionary dic, TreeNodeFactory factory ) : TreeNode
dic System.Collections.Dictionary
factory TreeNodeFactory
return TreeNode
        private static TreeNode FromDictionary(Dictionary dic, TreeNodeFactory factory)
        {
            // Setup initial conditions.
            TreeNode node = factory(dic);

            // Enumerate children.
            Array children = dic[PropChildren] as Array;
            if (children != null)
            {
                foreach (Dictionary child in children)
                {
                    TreeNode childNode = FromDictionary(child, factory);
                    node.AddChild(childNode);
                }
            }

            // Finish up.
            return node;
        }