title: populate Jagged Array with files C#
body: <p>I can't seem to figure out how to work with Jagged Arrays and Files. I have three files with numbers in them and wan to read each file into its own array. This is what I have so far. Was trying to populate the [0] array but to no avail. Any help appreciated. Can't find any tutorials on doing this, either.</p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
  {
      StreamWriter section1;
      StreamWriter section2;
      StreamWriter section3;
      StreamReader section1read;
      StreamReader section2read;
      StreamReader section3read;
  
      section1 = File.CreateText("Section1.txt");
      section2 = File.CreateText("Section2.txt");
      section3 = File.CreateText("Section3.txt");
  
      int[][] Scores = new int[3][];
  
      Random randnum = new Random();
  
      for (int i = 0; i &lt; 12; ++i)
      {
          int num = randnum.Next(55, 99);
          section1.WriteLine(num);
      }
  
      for (int j = 0; j &lt; 8; ++j)
      {
          int num1 = randnum.Next(55, 99);
          section2.WriteLine(num1);
      }
  
      for (int k = 0; k &lt; 10; ++k)
      {
          int num3 = randnum.Next(55, 99);
          section3.WriteLine(num3);
      }
  
      section1.Close();
      section2.Close();
      section3.Close();
  
      section1read = File.OpenText("Section1.txt");
  
      int nums = 0;
      while (!section1read.EndOfStream)
      {
          Scores[0][nums] = int.Parse(section1read.ReadLine());
          ++nums;
      }
      for (int i = 0; i &lt; Scores.Length; ++i)
      {
          listBox1.Items.Add(Scores[0][i]);
      }
      section1read.Close();
  }
  </code></pre>