Skip to content

Instantly share code, notes, and snippets.

@btodts btodts/Guard.cs
Created Apr 5, 2019

Embed
What would you like to do?
public static class Guard
{
public static void GuidNotEmpty(Guid argument, string argumentName)
{
if (argument == Guid.Empty)
throw new ArgumentException("Guid should not be empty.", argumentName);
}
public static void StringNotNullOrEmpty(string argument, string argumentName)
{
if (string.IsNullOrEmpty(argument))
throw new ArgumentNullException(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
You can’t perform that action at this time.