Last active
August 29, 2015 14:16
-
-
Save mat-mcloughlin/6f2082f0fc35c20c6573 to your computer and use it in GitHub Desktop.
guard.cs
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 Foo | |
{ | |
using System; | |
internal static class Guard | |
{ | |
internal static void EnsureNotNull(object argument, string argumentName) | |
{ | |
if (argument == null) | |
{ | |
throw new ArgumentNullException(argumentName); | |
} | |
} | |
internal static void EnsureNullOrWhiteSpace(string argument, string argumentName) | |
{ | |
if (string.IsNullOrWhiteSpace(argument)) | |
{ | |
throw new ArgumentException(string.Format("{0} is null or whitespace",argumentName)); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment