title: Index outside of bounds of array when parsing file
body: <pre><code> using System;
   using System.Collections.Generic;
   using System.Linq;
   using System.Text;
   using System.Net;
   using System.IO;
  namespace App
  {
   class Program
    {
      public static List&lt;Types&gt; List = new List&lt;Types&gt;();
  
      static void Main(string[] args)
      {                  
      using (StreamReader read = new StreamReader(fileName.xml))
             {
                 read.ReadLine();
                 while (!read.EndOfStream)
                 {
                     string line = read.ReadLine();
                     string[] splitline = line.Split('|');
                     Types t = new Types();
  
                     t.nbr = Convert.ToInt64(splitline[0].Trim());
                     t.addr = splitline[1].Trim().Length &gt; 1 ? splitline[3] : "";
                     List.Add(t);
                 }
             }
          }
      }
    }
  
   public class Types
    {
      public Types()
      {
      }      
     public long nbr { get; set; } 
     public string addr { get; set; }
    }
  </code></pre>
  
  <p>I'm splitting the lines by '|' and after the split the text does not contain any of these '|' as well.
  Its specifically happening at this line</p>
  
  <pre><code>t.addr = splitline[1].Trim().Length &gt; 1 ? splitline[3] : "";
  </code></pre>
  
  <p>I don't notice anything wrong with the text its parsing as I'm handle a null and such</p>
  
  <p>Heres an example of what the text may look like:</p>
  
  <pre><code> 3612|
   1412|123 Circle st Miami,FL,87678
   1420|
   3587|23 Hamm st Chicago,IL,98678
  </code></pre>