Reading file with C#
<p>I want to read php text file using c#. The file looks like:</p>

<pre><code>2.20:2.20:2.20:2.20:2.20:
2012-07-12:2012-07-11:2012-07-10:2012-07-09:2012-07-08:
</code></pre>

<p>I would like to get all lines to listboxes. In real situation there is six lines, but first I should have read these two lines. My code:</p>

<pre><code>void web_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
     try
     {
         int i;
         string price_line = "";
         string date_line = "";
         List&lt;decimal&gt; prices = new List&lt;decimal&gt;();
         List&lt;string&gt; dates = new List&lt;string&gt;();

         using (var reader = new StreamReader(e.Result))
         {
             price_line = reader.ReadLine();
             date_line = reader.ReadLine();
             string[] bit_1 = price_line.Split(':');
             string[] bit_2 = date_line.Split(':');
             for (i = 0; i &lt; 2; i++)
             {
                 prices.Add(decimal.Parse(bit_1[i]));
                 dates.Add(bit_2[i]);
             }
             listBox1.ItemsSource = prices;
             listBox2.ItemsSource = dates;
         }
     }
     catch
     {
          MessageBox.Show("Can't read!");
     }           
}
</code></pre>

<p>Now I get "NullException". How to fix this?</p>
