title: Is it OK to use a public variable in C# if it is readonly?
body: <p>Is there some internal difference between the C# syntactic sugar way of making properties:</p>
  
  <pre><code>public string FirstName { get; set; }
  </code></pre>
  
  <p>and just making public variables like this:</p>
  
  <pre><code>public string LastName;
  </code></pre>
  
  <p>I assume the first way is preferred and the second to be avoided. However, I often see this type of readonly property being used which is a form of the second type above:</p>
  
  <pre><code>public readonly string InternalCode;
  </code></pre>
  
  <p>Is this a best-practice way to create readonly property?</p>
  
  <pre><code>using System;
  
  namespace TestProps
  {
      class Program
      {
          static void Main(string[] args)
          {
              Customer customer = new Customer();
              customer.FirstName = "Jim";
              customer.LastName = "Smith";
              customer.Show();
          }
      }
  
      class Customer
      {
          public string FirstName { get; set; } //prefered
          public string LastName; //avoid
          public readonly string InternalCode; //???
  
          public Customer()
          {
              InternalCode = "234729834723984";
          }
  
          public void Show()
          {
              Console.WriteLine("{0}, {1} ({2})", LastName, FirstName, InternalCode);
              Console.ReadLine();
          }
      }
  }
  </code></pre>