if <paramref name="argument"/> is null.</summary>
/// <param name="argument">The reference type argument to validate as non-null.</param>
/// <param name="paramName">The name of the parameter with which <paramref name="argument"/> corresponds.</param>
public static void ThrowIfNull([NotNull] object? argument, [CallerArgumentExpression("argument")] string? paramName = null)
if (argument is null)
As you can see, it's a small detail, that can simplify your consumer's life. If you are delivering libraries to other Teams or the Public, I suggest you give it a try. Inspire yourself in Microsoft work with
ArgumentNullException, and amaze your consumers.
🔗 You can find the source code used here.
I hope that this was useful! To get more tips like this, follow me on Twitter (@gsferreira) and let's keep in touch!