title: Constructor parameters and value object implementation choices
body: <p>I can't wrap my head around one dilemma.</p>
  <ol>
  <li><p>If i model my <code>ValueObjects</code> as c# <code>records</code> i end up in problems because of <code>with {Property = something}</code> because in that case auto-generated <code>init</code> properties might circumvent some logic enforced in constructor, e.g.</p>
  </li>
  <li><p>If i model them as regular classes, then i have to check if they are not null in constructors/methods that use them as parameters.</p>
  </li>
  <li><p>If i model them as <code>struct</code> (which i lean towards the most atm) then i don't have a null-check but still, i have a default value check (if its not allowed by an entity).</p>
  </li>
  <li><p>Last option i can think of is to model them as <code>struct</code> with private <code>isValid</code> property initially set to <code>false</code> which gets set to <code>true</code> in my constructor and gets checked in getters.</p>
  </li>
  </ol>
  <p>Are there any other options I'm missing that would hopefully make null-checks in constructors/methods that use VOs unnecessary and at the same time be truly immutable?</p>
  <p><strong>[UPDATE]</strong></p>
  <p>An example:</p>
  <pre><code>public LegalSubject(LegalSubjectId id,
                        GeneralInfo generalInfo,
                          VatId vatId,
                            LegalSubjectId? customerId
          {
          // LegalSubjectId cannot be null
          // GeneralInfo cannot be null
          // VatId cannot be null
  }
  </code></pre>
  <p>Now, properties for each value object (<code>GeneralInfo</code> e.g.) are checked at the time they're created. So, for example, its enforced that <code>GeneralInfo.Name</code> is not empty, <code>GeneralInfo.Email</code> is not empty, etc... (obviously, <code>struct</code> doesn't apply here because defaults would put VO into invalid state).</p>
  <p>What would be nice is to have a way to avoid null-checks/default-checks in this class that uses VOs.
  <code>struct</code> with <code>isValid</code> (which is set in non-default constructor) solves the issue but i was hoping there is some other solution i'm missing.</p>
  <p>PS.
  If nullable reference types would be enforced (instead of just warning), that would solve it. But its not.</p>