title: How do I exit a for loop with a key press?
body: <p>For my ASSIGNMENT, I am running this loop to gather id #'s and names in a 2d array. 
  But I would like to be able to break out of the loop if the user doesn't want to sit and enter 30 sets of numbers and names. Because... why would they?!</p>
  
  <pre><code>string[,] studentNames = new string[30,30];
  
  // Accepting value from user 
  for (i = 0; i &lt; 30; i++)
  {
      Console.Write("\nEnter id #, Student Name :\t");
  
      //Storing value in an array
      studentNames[i, 0] = (Console.ReadLine());
  }
  </code></pre>
  
  <p>I've tried adding:</p>
  
  <pre><code>do
  {
   //the stuff
  } while(Console.ReadKey().Key != ConsoleKey.Escape);
  </code></pre>
  
  <p>But that doesn't work.</p>