title: I want to replace the data in a text file with an array and store it in a variable
body: <p>The goal is to graph the data in a text file.</p>
  
  <p>I will store it as an <code>int</code> in the array <code>y</code> and as a <code>string</code> in the array <code>x</code></p>
  
  <p>There are two text files, <code>x.txt</code> and <code>y.txt</code>, each of which is separated by <em>spaces</em>. like <code>y</code> is <code>1 2 3 4 5 6</code>  and <code>x</code> is <code>a b c d</code>.</p>
  
  <p>I hope to store it in array, like </p>
  
  <pre><code> int[]    y = {1, 2, 3, 4, 5, 6};
   string[] x = {"a", "b", "c", "d"};
  </code></pre>
  
  <p>I try <code>StreamReader</code>... but I'm fail</p>
  
  <p>so I want to give an example of my problem.</p>
  
  <pre><code>StreamReader sy = new StreamReader("F:/C#/graph/graph/bin/Debug/y.txt", 
  Encoding.Default);
          string[] ty = sy.ReadToEnd().Split(' ');
          Console.WriteLine(ty);
          for (int i = 0; i &lt; ty.Length; i++)
          {
                  y[i] = Int32.Parse(ty[i]);
                  return;
                             }
  </code></pre>