Should I check if argument is null if I'm going to use it immediately?
<p>I'm so used to check if a method's argument is null (then proceed to throw an exception) that I almost don't even think about it anymore.
If the argument is a reference type, it's there:</p>

<pre><code>if(arg == null)
    throw new ArgumentNullException(nameof(arg));
</code></pre>

<p>But what if I'm going to use arg immediately? Should I check anyway? I mean, if I don't, the envinroment will throw for me (a NullReferenceException) anyway.</p>

<p>For instance:</p>

<pre><code>public int DoStuff(object o)
{
    return o.GetHashCode();
}
</code></pre>

<p>I could write add the null check easily:</p>

<pre><code>public int DoStuff(object o)
{
    if(o == null)
        throw new ArgumentNullException(nameof(o));
    return o.GetHashCode();
}
</code></pre>

<p>But in both cases a exception will be thrown (in almost the exact same line, for debugging purpose). The only difference is the type.</p>

<p><strong>The question:</strong> On <em>public</em> methods with a <em>single reference type argument</em>, if I'm going to use the argument <em>immediately</em>, should I still <em>check</em> it if it's <code>null</code>?</p>