Using C# 7.2 in modifier for parameters with primitive types : <p>C# 7.2 introduced the <code>in</code> modifier for passing arguments by reference with the guarantee that the recipient will not modify the parameter.</p>

<p>This <a href="https://blogs.msdn.microsoft.com/seteplia/2018/03/07/the-in-modifier-and-the-readonly-structs-in-c/" rel="noreferrer">article</a> says:</p>

<blockquote>
  <p>You should never use a non-readonly struct as the in parameters because it may negatively affect performance and could lead to an obscure behavior if the struct is mutable</p>
</blockquote>

<p>What does this mean for built-in primitives such as <code>int</code>, <code>double</code>?</p>

<p>I would like to use <code>in</code> to express intent in code, but not at the cost of performance losses to defensive copies.</p>

<p>Questions</p>

<ul>
<li>Is it safe to pass primitive types via <code>in</code> arguments and not have defensive copies made?</li>
<li>Are other commonly used framework structs such as <code>DateTime</code>, <code>TimeSpan</code>, <code>Guid</code>, ... considered <code>readonly</code> by the JIT?

<ul>
<li>If this varies by platform, how can we find out which types are safe in a given situation?</li>
</ul></li>
</ul>
