title: C#: Resize String Array
body: <p>I'm new to programming and I have decided to give myself a challenge by creating a random word generator based on user input.
  I'm trying to put the user's words inside of an array and then display a random word from the the array. When I run the program I am able to enter up to four words and then I receive an error: "Array index is out of range."</p>
  
  <p>Is there a limit to how many times I can resize an array?</p>
  
  <pre><code>using System;
  
  namespace RandomWordGenerator
  {
  class MainClass
  {
      public static void Main (string[] args)
      {
          Random r = new Random ();
          string[] words = new string[1];
          Console.WriteLine ("Enter words for the random word generator. ");
  
          int a = 0;
          while(!(Console.ReadLine().Equals("END"))){
              words[a] = Console.ReadLine();
              a++;
              Array.Resize(ref words, a);
          }
  
          Console.WriteLine ();
          Console.WriteLine (words[r.Next (a)]);
      }
  }
  }
  </code></pre>