public static ThrowArgumentNullException ( string paramName ) : void | ||
paramName | string | |
return | void |
/// <summary> /// Determines whether the specified parameter is null. /// </summary> /// <typeparam name="T">The parameter type.</typeparam> /// <param name="param">The parameter.</param> /// <param name="paramName">The name of the parameter.</param> /// <exception cref="ArgumentNullException">The parameter is null.</exception> public static void IsNotNull <T>(T param, string paramName) where T : class { if (param is null) { ExceptionUtil.ThrowArgumentNullException(paramName); } }
/// <summary> /// Determines whether the specified parameter is null, empty or contains only whitespace characters. /// </summary> /// <param name="param">The parameter.</param> /// <param name="paramName">The name of the parameter.</param> /// <exception cref="ArgumentNullException">The parameter is null.</exception> /// <exception cref="ArgumentException">The parameter is empty or contains only whitespace characters.</exception> public static void IsNotNullOrWhiteSpace(string param, string paramName) { if (param is null) { ExceptionUtil.ThrowArgumentNullException(paramName); } else if (param.IsEmptyOrWhiteSpace()) { ExceptionUtil.ThrowArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.ParameterStringIsEmptyOrWhitespaceFormat, paramName)); } }
/// <summary> /// Determines whether the specified array is null or empty. /// </summary> /// <param name="param">The parameter.</param> /// <param name="paramName">The name of the parameter.</param> /// <exception cref="ArgumentNullException">The parameter is null.</exception> /// <exception cref="ArgumentException">The parameter is a zero-length array.</exception> public static void IsNotNullOrEmptyArray <T>(T[] param, string paramName) { if (param is null) { ExceptionUtil.ThrowArgumentNullException(paramName); } else if (param.Length == 0) { ExceptionUtil.ThrowArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.ParameterIsEmptyArrayFormat, paramName)); } }