title: C# Console.Write using While loop to insert more records?
body: <p>I want to insert a while loop in the following code in order to insert more than one record.</p>
  
  <p>The code output asks for Name and ID and then print them out in a text file.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>Console.Write(" Enter your ID: ");
  int ID = int.Parse(Console.ReadLine());
  Console.Write(" Enter your Name: ");
  string Name = Console.ReadLine();
  Console.WriteLine(" Thank you! you are logged in as " + Name + " " + ID);
  StreamWriter sw = new StreamWriter("fileone.txt", true);
  Console.SetOut(sw);
  Console.WriteLine("Thank you! you are logged in as " + Name + " " + ID);
  Console.Read();
  
  sw.Close();
  </code></pre>
  
  <p>How can I use while loop in order to to let the program ask for another 10 records to enter?</p>
  
  <p>Any answers would be appreciated.</p>
  
  <p>Thanks in advance.</p>