title: read a value by its index from a file in C#
body: <p>I'm new to programming, so please forgive my naive question . </p>
  
  <p>I have double[ ] array, I manage to write it to text file using the code below:  </p>
  
  <pre><code>using (System.IO.StreamWriter outfile = new System.IO.StreamWriter(@"C:\Seasonality.txt") )
    {
       for (int raw = 1; raw &lt;54; raw++)
       {
         outfile.Write("{0} ",array[raw]);
       }
    }
  </code></pre>
  
  <p>The output text file (1 raw) consist of 54 records separated by space  as demonstrated below: </p>
  
  <pre><code>1.323 2.3443 2.367 5.3453 0.3432 1.754 ........etc 
  </code></pre>
  
  <p>What I'm trying to achieve is a function where I read a value by passing its index, i.e. index =1 for the first value in the file, or index =5 for the fifth value in the file etc..</p>
  
  <pre><code>Double GetValue (int index) 
  {
  .....
  }
  </code></pre>
  
  <p>P.S: please suggest if you think that changing output file structure to one value per line will ease the task.</p>
  
  <p>Thanks in advance</p>