title: C# foreach loop between 2 values
body: <p>How can I use a <code>foreach</code> statement to loop between 2 values given by the user?</p>
  
  <p>I am making an application that scans for ports, so I want the user to specify which ports to search for; here is some example code that dose not function, but should help you understand what I am looking for:</p>
  
  <pre><code>int port1 = Int32.Parse(TextBox1.Text);
  int port2 = Int32.Parse(TextBox2.Text);
  
  foreach(int between port1 and port2)
  {
    //do something 
  }
  </code></pre>
  
  <p>Any suggestions on how I could do this ? </p>