ICSharpCode.ILSpy.TreeNodes.AssemblyTreeNode.LoadChildren C# (CSharp) Method

LoadChildren() protected method

protected LoadChildren ( ) : void
return void
        protected override void LoadChildren()
        {
            ModuleDefinition moduleDefinition = assembly.ModuleDefinition;
            if (moduleDefinition == null)
            {
                // if we crashed on loading, then we don't have any children
                return;
            }

            foreach (NamespaceTreeNode ns in namespaces.Values)
            {
                ns.Children.Clear();
            }
            foreach (TypeDefinition type in moduleDefinition.Types.OrderBy(t => t.FullName))
            {
                NamespaceTreeNode ns;
                if (!namespaces.TryGetValue(type.Namespace, out ns))
                {
                    ns = new NamespaceTreeNode(type.Namespace);
                    namespaces[type.Namespace] = ns;
                }
                TypeTreeNode node = new TypeTreeNode(type, this);
                typeDict[type] = node;
                ns.Children.Add(node);
            }
            foreach (NamespaceTreeNode ns in namespaces.Values.OrderBy(n => n.Name))
            {
                if (ns.Children.Count > 0)
                    this.Children.Add(ns);
            }
        }