is it possible to build and new a structure in a loop?
<p>I want to know that How can I walk through this loop ?
this has a root 
two chldren priv and nonpriv
and children of them for 
priv:0,1,2,...,1023
and children of Nonpriv:
1024,..,65535</p>

<pre><code>              |Any______________PORT|
                 |              |
             |Priv|          |Non-Priv|
            |||||...||||   ||||....|||||
            0123,.....1023 1024,...65535
</code></pre>

<p>I mean that 0 is in a distinct Node
1 is in a distinct Node
2 is in a distinct Node
these ports has parent PRIV
my reason of distincting them is that maybe some day 0 will have the list of children<br>
they could be in a list and we can have a list of nodes or they could be in a list of strings but I can not decide what to do next about the list of string
and the problem with list of Node is in the for loop which I couldn't build Nodes</p>

<p>Now I can't configure the for loop how should I correct my code?</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace IDS
{
    class Program
    {
        static void Main(string[] args)
        {
            Node root = new Node("Any_PORT");
            List&lt;Node&gt; portcat = new List&lt;Node&gt;();
            Node Priv = new Node("Priv");
            Node NonPriv=new Node("Non-Priv");
            root.setchildren(portcat);
            root.Thisisroot();
            root.setNodeinlist(Priv);
            root.setNodeinlist(NonPriv);
            Priv.setparent(root);
            NonPriv.setparent(root);
            List&lt;Node&gt; portsP = new List&lt;Node&gt;();
            Priv.setchildren(portsP);
            for (int i = 0; i &lt; 1024; i++)
            {

            }
    //I tried this one but I can't fix between Nodes and list of a string        
    List&lt;string&gt; portsN = new List&lt;string&gt;();
            for (int i = 1024; i &lt; 65535; i++)
            {
                portsN.Add(i.ToString());
            }
        }

        public class Node
        {
            public string Data;
            public List&lt;Node&gt; Children = new List&lt;Node&gt;();
            public Node parent;
            public Node(string r)
            {
                this.Data = r;
             }
            public Node Thisisroot()
            {
                this.parent = null;
                return this;
            }
            public void setchildren(List&lt;Node&gt; list)
            {
                this.Children = list;
            }
            public List&lt;Node&gt; getchildren()
            {
                return this.Children;
            }
            public void setparent(Node p)
            {
                this.parent = p;
            }
            public Node getparent()
            {
                return this.parent;
            }
            public void setNodeinlist(Node n)
            {
                this.Children.Add(n);
            }

        }
    }
}
</code></pre>
