/// <summary> /// Ensures a sequence is not empty. /// </summary> /// <typeparam name="TItem">Type of items in the collection.</typeparam> /// <param name="param">Parameter to check.</param> /// <param name="paramName">Name of parameter.</param> /// <exception cref="T:ByteDev.Exceptions.ArgumentEmptyException"><paramref name="param" /> is empty.</exception> public static void NotEmpty <TItem>(IEnumerable <TItem> param, string paramName = null) { if (!param.Any()) { ExceptionThrower.ThrowIsEmptyException(paramName); } }
/// <summary> /// Ensures a string is not empty. /// </summary> /// <param name="param">Parameter to check.</param> /// <param name="paramName">Name of the parameter.</param> /// <exception cref="T:ByteDev.Exceptions.ArgumentEmptyException"><paramref name="param" /> is empty.</exception> public static void NotEmpty(string param, string paramName = null) { if (param == string.Empty) { ExceptionThrower.ThrowIsEmptyException(paramName); } }