ThrowIfEmpty Method
Definition
ThrowIfEmpty(string, string, string)
Validates and throws an ArgumentException if the specified argument is empty.
public static void ThrowIfEmpty(string argument, string message = "Value cannot be empty.", string paramName = null)
Parameters
argumentstringThe value to be evaluated.
messagestringA message that describes the error.
paramNamestringThe name of the parameter that caused the exception.
Remarks
This method will not throw an exception if argument is null.
Exceptions
- ArgumentException
argumentcannot be empty.