title: Is there a way of setting a property once only in C#
body: <p>I'm looking for a way to allow a property in a C# object to be set once only. It's easy to write the code to do this, but I would rather use a standard mechanism if one exists.</p>
  
  <pre>
  public OneShot&lt;int&gt; SetOnceProperty { get; set; }
  </pre>
  
  <p>What I want to happen is that the property can be set if it is not already set, but throw an exception if it has been set before. It should function like a Nullable value where I can check to see if it has been set or not.</p>