Ejemplo n.º 1
0
 /// <summary>
 /// Ensures a string is not null or empty.
 /// </summary>
 /// <param name="param">Parameter to check.</param>
 /// <param name="paramName">Name of the parameter.</param>
 /// <exception cref="T:ByteDev.Exceptions.ArgumentNullOrEmptyException"><paramref name="param" /> is null or empty.</exception>
 public static void NotNullOrEmpty(string param, string paramName = null)
 {
     if (string.IsNullOrEmpty(param))
     {
         ExceptionThrower.ThrowIsNullOrEmptyException(paramName);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Ensures a sequence is not null or empty.
 /// </summary>
 /// <typeparam name="TItem">Type of items in the collection.</typeparam>
 /// <param name="param">Parameter to check.</param>
 /// <param name="paramName">Name of the parameter.</param>
 /// <exception cref="T:ByteDev.Exceptions.ArgumentNullOrEmptyException"><paramref name="param" /> is null or empty.</exception>
 public static void NotNullOrEmpty <TItem>(IEnumerable <TItem> param, string paramName = null)
 {
     if (param == null || !param.Any())
     {
         ExceptionThrower.ThrowIsNullOrEmptyException(paramName);
     }
 }