Skip to content

Instantly share code, notes, and snippets.

@pseudomuto
Created August 12, 2013 12:15
Show Gist options
  • Save pseudomuto/6210341 to your computer and use it in GitHub Desktop.
Save pseudomuto/6210341 to your computer and use it in GitHub Desktop.
A simple class for guarding against nulls, etc..
internal static class Guard
{
public static void AgainstNull(string name, object value)
{
if (value == null)
{
throw new ArgumentNullException(name);
}
}
public static void AgainstNullOrEmpty(string name, string value)
{
if (string.IsNullOrEmpty(value))
{
throw new ArgumentNullException(name);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment