ThrowIfNullOrEmpty Method
Definition
ThrowIfNullOrEmpty(string, string, string)
Validates and throws either an ArgumentNullException or ArgumentException if the specified argument is respectively null or empty.
public static void ThrowIfNullOrEmpty(string argument, string message = null, string paramName = null)
Parameters
argumentstringThe value to be evaluated.
messagestringA message that describes the error to your liking.
paramNamestringThe name of the parameter that caused the exception.
Exceptions
- ArgumentNullException
argumentcannot be null.- ArgumentException
argumentcannot be empty.