Inheritance: TreeNode
Exemple #1
0
        private void ProcessTypeNodeToTree(Node typeNode, TypeDefinition type)
        {
            if (type.IsEnum)
            {
                foreach (FieldDefinition enumItem in type.Fields)
                {
                    if (enumItem.IsSpecialName)
                    {
                        continue;
                    }
                    var enumItemNode = new EnumNode(enumItem.Name);
                    typeNode.Nodes.Add(enumItemNode);
                }
                return;
            }

            // constructors
            foreach (MethodDefinition ctor in type.Constructors)
            {
                var methodNode = MethodNodeFactory.CreateNode(ctor);
                typeNode.Nodes.Add(methodNode);
            }
            // properties
            foreach (PropertyDefinition property in type.Properties)
            {
                var propertyNode = PropertyNodeFactory.CreateNode(property);
                typeNode.Nodes.Add(propertyNode);
            }
            // methods
            foreach (MethodDefinition method in type.Methods)
            {
                if (!method.IsGetter && !method.IsSetter)
                {
                    var methodNode = MethodNodeFactory.CreateNode(method);
                    typeNode.Nodes.Add(methodNode);
                }
            }
        }
Exemple #2
0
        private void ProcessTypeNodeToTree(Node typeNode, TypeDefinition type)
        {
            if (type.IsEnum)
            {
                foreach (FieldDefinition enumItem in type.Fields)
                {
                    if (enumItem.IsSpecialName)
                        continue;
                    var enumItemNode = new EnumNode(enumItem.Name);
                    typeNode.Nodes.Add(enumItemNode);
                }
                return;
            }

            // constructors
            foreach (MethodDefinition ctor in type.Constructors)
            {
                var methodNode = MethodNodeFactory.CreateNode(ctor);
                typeNode.Nodes.Add(methodNode);
            }
            // properties
            foreach (PropertyDefinition property in type.Properties)
            {
                var propertyNode = PropertyNodeFactory.CreateNode(property);
                typeNode.Nodes.Add(propertyNode);
            }
            // methods
            foreach (MethodDefinition method in type.Methods)
            {
                if (!method.IsGetter && !method.IsSetter)
                {
                    var methodNode = MethodNodeFactory.CreateNode(method);
                    typeNode.Nodes.Add(methodNode);
                }
            }
        }