Skip to content

Instantly share code, notes, and snippets.

@btodts
Created April 5, 2019 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btodts/f13b6722e8f4569bb179f63d91a30d6c to your computer and use it in GitHub Desktop.
Save btodts/f13b6722e8f4569bb179f63d91a30d6c to your computer and use it in GitHub Desktop.
public static class Guard
{
public static void GuidNotEmpty(Guid argument, string argumentName)
{
if (argument == Guid.Empty)
throw new GuardException(argumentName, "Guid should not be empty.");
}
public static void StringNotNullOrEmpty(string argument, string argumentName)
{
if (string.IsNullOrEmpty(argument))
throw new GuardException(argumentName, "String should not be null or empty.");
}
// other guards
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment