Example #1
0
 public static void NotEmpty <T>([NotNull] T[] arg, [NotNull, InvokerParameterName] string argName)
 {
     if (arg.Length == 0)
     {
         throw CodeExceptions.ArgumentEmpty(argName);
     }
 }
Example #2
0
 public static void NotEmpty <T>([NotNull] ICollection <T> arg, [NotNull, InvokerParameterName] string argName)
 {
     if (arg.Count == 0)
     {
         throw CodeExceptions.ArgumentEmpty(argName);
     }
 }
Example #3
0
 public static void NotEmpty <T>([NotNull] IEnumerable <T> arg, [NotNull, InvokerParameterName] string argName)
 {
     using (var en = arg.GetEnumerator())
         if (!en.MoveNext())
         {
             throw CodeExceptions.ArgumentEmpty(argName);
         }
 }
Example #4
0
 public static void NotNullNorEmpty <T>(
     [CanBeNull, InstantHandle] IEnumerable <T> arg,
     [NotNull, InvokerParameterName] string argName)
 {
     if (arg == null)
     {
         throw CodeExceptions.ArgumentNull(argName);
     }
     if (!arg.Any())
     {
         throw CodeExceptions.ArgumentEmpty(argName);
     }
 }
 public static void NotNullNorEmpty <T>(
     [AllowNull, SDC.NotNull] T?[]?arg,
     [InvokerParameterName] string argName)
 {
     if (arg == null)
     {
         throw CodeExceptions.ArgumentNull(argName);
     }
     if (arg.Length == 0)
     {
         throw CodeExceptions.ArgumentEmpty(argName);
     }
 }
Example #6
0
 public static void NotNullNorEmpty <T>(
     [AllowNull, SDC.NotNull, ValidatedNotNull] ICollection <T>?arg,
     [InvokerParameterName] string argName)
 {
     if (arg == null)
     {
         throw CodeExceptions.ArgumentNull(argName);
     }
     if (arg.Count == 0)
     {
         throw CodeExceptions.ArgumentEmpty(argName);
     }
 }
Example #7
0
 public static void NotNullNorEmpty <T>(
     [AllowNull, SDC.NotNull, InstantHandle, ValidatedNotNull] IEnumerable <T>?arg,
     [InvokerParameterName] string argName)
 {
     if (arg == null)
     {
         throw CodeExceptions.ArgumentNull(argName);
     }
     if (!arg.Any())
     {
         throw CodeExceptions.ArgumentEmpty(argName);
     }
 }