title: C# - Unable to declare a private variable in constructor
body: <p>I'm unable to declare a private variable in the class constructor in C#. I faced this issue when I was trying to declare a private DateTime variable. Here's the code I had when I ran into this problem:<br/><br/></p>
  
  <pre><code>namespace FirstCSApp
  {
      public class MyStopWatch
      {
          public MyStopWatch()
          {
              private DateTime _start = new DateTime();
          }
      }
  }
  </code></pre>
  
  <p>There are two errors that VS gives me:<br/>1) After the opening curly bracket, I get an error saying "<em>expected }</em>" and, <br/>2) At the last curly bracket, I get an error that says "<em>Type or namespace definition , or end-of-file expected</em>"<br/><br/>The way I resolved the issue was to declare the variable outside the constructor and then initialize it in the constructor. However, I still don't understand why I'm unable to declare and initialize a private variable inside the constructor while declaring the variable without a public/private modifier works just fine.</p>