Created
August 13, 2016 16:53
-
-
Save moander/e52ddfdda895c46aad7e28b961c0db5d to your computer and use it in GitHub Desktop.
whatever.ThrowIfNull(nameof(whatever));
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace System | |
{ | |
public static class ThrowIfNullExtension | |
{ | |
// whatever.ThrowIfNull(nameof(whatever)); | |
[System.Diagnostics.DebuggerStepThrough] | |
public static void ThrowIfNull<T>(this T o, string paramName) | |
where T : class | |
{ | |
if (o == null) | |
{ | |
throw new ArgumentNullException(paramName); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment