title: Trying to get the command window to not go away
body: <p>I am very new to C#. So please help me with this doubt.  </p>
  
  <p>When I run this code, the screen will pause and wait for an input.</p>
  
  <pre><code>    namespace HelloWorld1
      {
          class Program
          {
              static void Main(string[] args)
              {
                  //int x=2;
                  Console.WriteLine("Hello world! Enter an int.");
                  Console.Read();
                 /* x=Console.Read();
                  Console.WriteLine("you've entered: " + x + " .");
                  Console.ReadLine();
                  */
              }
          }
      }
  </code></pre>
  
  <p>But when I change the code to below, it the screen no longer pause... :</p>
  
  <pre><code>namespace HelloWorld1
  {
      class Program
      {
          static void Main(string[] args)
          {
              int x=2;
              Console.WriteLine("Hello world! Enter an int.");
              //Console.Read();
              x=Console.Read();
              Console.WriteLine("you've entered: " + x + " .");
              Console.Read();
          }
      }
  }
  </code></pre>
  
  <p>Why is this happening?  </p>
  
  <p>Edit:</p>
  
  <p>latest code (still doesn't pause screen):</p>
  
  <pre><code>namespace HelloWorld1
  {
      class Program
      {
          static void Main(string[] args)
          {
              int x=2;
              Console.WriteLine("Hello world! Enter an int.");
              x=Console.Read();
              Console.WriteLine("you've entered: " + x + " .");
              Console.ReadLine();
          }
      }
  }
  </code></pre>