title: How to create immutable objects in C#?
body: <p>In a question about <a href="https://softwareengineering.stackexchange.com/questions/51062/constructor-parameter-validation-in-c-best-practices">Best practices for C# pattern validation</a>, the highest voted answer
  says:</p>
  
  <blockquote>
    <p>I tend to perform all of my validation in the constructor. This is a must because I almost always create immutable objects. </p>
  </blockquote>
  
  <p>How exactly do you create an immutable object in C#? Do you just use the <code>readonly</code> keyword?</p>
  
  <p>How exactly would this work if you want to validate in the constructor of your Entity Framework generated model class?</p>
  
  <p>Would it look like below?</p>
  
  <pre><code>public partial readonly Person
  {
      public Person()
  }
  </code></pre>