title: C# parsing a text file and storing the values in an array
body: <p>I am trying to read in a text file which has this format below, into an array:</p>
  
  <pre><code>Previous errors were for Test id '1234567' Error id '12345678'
  Previous errors were for Test id '1234567' Error id '12345678'
  Previous errors were for Test id '1234567' Error id '12345678'
  </code></pre>
  
  <p>What I need to do is to, inspect each line and once it finds the first integer value, store all 7 integers after this i.e. 1234567 and assign it to test id. 
  Then move on and do the same for error id i.e. inspect the rest of the line and once it hits the next integer value, store all 8 integers after this and assign it to Error id.</p>
  
  <p>The values stored in the array will then be used in a program to call a database with a stored proc.</p>
  
  <p>My code below at the moment is just reading the whole line into an array, I am just trying to figure out the best way to do above:</p>
  
  <pre><code> List&lt;int&gt; test = new test&lt;int&gt;();
   using (var reader = new StreamReader(@"D:\Temp\AccessEmail.txt"))
   {
       string line;
       while ((line = reader.ReadLine()) != null)
        {   
           Test.Add(line);      
        }
   }
   Int[] test = test.ToArray(); //converts the list to array
   Console.WriteLine(test.Length); //return the number of elements of array
  </code></pre>