public static void NotEmpty <T>([NotNull] T[] arg, [NotNull, InvokerParameterName] string argName) { if (arg.Length == 0) { throw CodeExceptions.ArgumentEmpty(argName); } }
public static void NotEmpty <T>([NotNull] ICollection <T> arg, [NotNull, InvokerParameterName] string argName) { if (arg.Count == 0) { throw CodeExceptions.ArgumentEmpty(argName); } }
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); } }
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); } }
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); } }
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); } }