title: Loop only fires once
body: <p>Hi guys i am reading a file containing playlists.
  (Rows of mp3 file locations)</p>
  
  <p>I currently have the format     ( name ; c:\song.mp3 ; c:\song.mp3 ; c:\song.mp3 ; c:\song.mp3 etc etc)</p>
  
  <p>There are many rows of these in the file.</p>
  
  <p>I have tried both <code>foreach</code> loops and for loops to try and solve this (as shown below)</p>
  
  <pre><code>string[] lines = File.ReadAllLines("playlists.txt");
  MessageBox.Show(lines.Count().ToString());
  
  for (int y = 0; y &lt;= lines.Count(); y++)
  {
       string[] res = lines[y].Split(';');
       for (int x = 0; x &lt;= res.Count(); x ++)
       {
            if (x == 0) { currentPlaylist = new Playlist(res[x]); }
            else { currentPlaylist.Add(new MP3(res[x])); }
       }
  }
  </code></pre>
  
  <p>But for some reason it will only loop once (I have replaced the outer loop with a <code>foreach</code> which had the same result.</p>
  
  <p>even if the lines.Count() shown in the messagebox shows a number greater then 1</p>
  
  <p>I'm sure once this is solved it must be basic mistake but Im lost</p>
  
  <p>Thanks</p>
  
  <p>EDIT* this is the file dont know how this will help...</p>
  
  <pre><code>Library;C:\Users\Blah\Desktop\Iphone Music\Queens of the Stone Age - If I Had A Tail.mp3
  
  playlist1;C:\Users\Blah\Desktop\Iphone Music\Red Hot Chili Peppers - Can t Stop.mp3;C:\Users\Blah\Desktop\Iphone Music\Red Hot Chili Peppers - Otherside .mp3
  
  playlist2;C:\Users\Blah\Desktop\Iphone Music\Red Hot Chili Peppers - Otherside .mp3;C:\Users\Blah\Desktop\Iphone Music\Foo Fighters - Best Of You.mp3
  
  playlist3;C:\Users\Blah\Desktop\Iphone Music\Red Hot Chili Peppers - Otherside.mp3;C:\Users\Blah\Desktop\Iphone Music\Foo Fighters - The Pretender.mp3
  
  playlist4;C:\Users\Blah\Desktop\Iphone Music\Foo Fighters - Everlong.mp3;C:\Users\Blah\Desktop\Iphone Music\Foo Fighters - My Hero.mp3;C:\Users\Blah\Desktop\Iphone Music\I Am Giant - City Limits.mp3
  </code></pre>
  
  <p>I put it in as code so it would be easier to read</p>
  
  <p>The only issue i am having is that the inner loop only fires once and i am unsure as to why.</p>
  
  <p>Something in the following ....</p>
  
  <pre><code>for (int x = 0; x &lt;= res.Count(); x ++)
       {
            if (x == 0) { currentPlaylist = new Playlist(res[x]); }
            else { currentPlaylist.Add(new MP3(res[x])); }
       }
  </code></pre>
  
  <p>is causing the outer loop to only fire once no matter the amount of lines in the code, if i remove the inner loop the outer loop loops the expected amount of times</p>