Skip to content

Instantly share code, notes, and snippets.

@moander
Created August 13, 2016 16:53
Show Gist options
  • Save moander/e52ddfdda895c46aad7e28b961c0db5d to your computer and use it in GitHub Desktop.
Save moander/e52ddfdda895c46aad7e28b961c0db5d to your computer and use it in GitHub Desktop.
whatever.ThrowIfNull(nameof(whatever));
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