title: How to read numbers in a .txt file to an integer array?
body: <p>I have a file that I need to save as an array. I am trying to convert a text file to an integer array using <code>StreamReader</code>. I just am unsure as to what to put in the for loop at the end of the code. </p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>//Global Variables
  int[] Original;
  //Load File
  private void mnuLoad_Click_1(object sender, EventArgs e)
  {
      //code to load the numbers from a file
      OpenFileDialog fd = new OpenFileDialog();
  
      //open the file dialog and check if a file was selected
      if (fd.ShowDialog() == DialogResult.OK)
      {
      //open file to read
      StreamReader sr = new StreamReader(fd.OpenFile());
      int Records = int.Parse(sr.ReadLine());
  
      //Assign Array Sizes
      Original = new int[Records];
  
      int[] OriginalArray;
  
      for (int i = 0; i &lt; Records; i++)
      {
      //add code here
      }
  }
  </code></pre>
  
  <p>The .txt file is:</p>
  
  <pre><code>    5
      6
      7
      9
      10
      2
  </code></pre>
  
  <p>PS I am a beginner, so my coding skills are very basic!</p>
  
  <p>UPDATE: I have previous experience using <code>Line.Split</code> and then mapping file to arrays but obviously that does not apply here, so what do I do now?</p>
  
  <pre><code>//as continued for above code
  for (int i = 0; i &lt; Records; i++)
  {
      int Line = int.Parse(sr.ReadLine());
      OriginalArray = int.Parse(Line.Split(';')); //get error here
  
      Original[i] = OriginalArray[0];
  }
  </code></pre>