title: Count how many numbers is between a range in a List<string> with C#
body: <p>I'm beginner C# programmer and I find myself a problem in a Windows Form Application that I'm working on Microsoft Visual C# 2010 Express. I have a button that opens a file dialog to select a specific Excel workbook and then retrieve the values of the first column and the fith column to a string like this:</p>
  
  <pre><code>string x = {"120,123,125,128,130,140,157,189,220,230,243,250"}
  </code></pre>
  
  <p>Then I've transformed this string and add to a list of string. Here is the code:</p>
  
  <pre><code>var y = string.Join(string.Empty, x).Split(',');
  List&lt;string&gt; listX = new List&lt;string&gt;();
  foreach (var x1 in y)
  {
      listX.Add(x1);
  }
  </code></pre>
  
  <p>The list format is like this:</p>
  
  <pre><code>listX1[0] = "120";
  listX1[1] = "123";
  listX1[2] = "125";
  </code></pre>
  
  <p>And so on. Now I have this method to count how many number are between, lets say, 123 and 150, which will give me the number of 5 (with 123 included). The method used is something like this:</p>
  
  <pre><code>public static int Count(IList&lt;int&gt; set, int min, int max)
  {
        int count = 0;
        foreach (int i in set)
            if( i &lt;= max &amp;&amp; i &gt;= min)
                count++
        return count;
  }
  </code></pre>
  
  <p>Where min in this case would be 123 and max would be 150.</p>
  
  <p>Now I know that I can't use this method because my list (listX1) is a list of strings. How can I manage to count the numbers between min and max, using C#? Anyone can help me with that? </p>
  
  <p>Hope you can help me. Many Thanks.</p>