Code inspection: Use 'ArgumentNullException.ThrowIfNull'
This inspection reports a manual null-check that throws ArgumentNullException and can be replaced with ArgumentNullException.ThrowIfNull(...). This makes guard clauses shorter and more idiomatic in modern C#.
Example
if (arg == null)
throw new ArgumentNullException(nameof(arg));
ArgumentNullException.ThrowIfNull(arg);
Quick-fix
Replace the manual null-check and throw with ArgumentNullException.ThrowIfNull(...).
29 March 2026