title: Is there a benefit to null-checking using the ?? operator?
body: <p>I recently ran across a piece of code a coworker had written where he checks for bad input like this:</p>
  <pre><code>_ = input ?? throw new ArgumentNullException(nameof(input), &quot;Input may not be null.&quot;);
  </code></pre>
  <p>If I'm reading that correctly, it says 'if input is not null, return input and discard it; otherwise throw the exception (and in theory, discard the return value, which is kind of meaningless in this context).</p>
  <p>I've never seen it done this way before. If it were me, I would've written something like this:</p>
  <pre><code>if (input == null)
  {
      throw new ArgumentNullException(nameof(input), &quot;Input may not be null.&quot;);
  }
  </code></pre>
  <p>Is there any good reason to do it the way my coworker did?  To me, using a discard with the ?? operator is much less readable, and I can't see any benefits to doing it that way. Am I missing something, or is that just a more obfuscated way to do a very basic task?</p>