using System; using System.Collections.Generic; using System.Diagnostics; using Abp.Collections.Extensions; using Abp.Extensions; using JetBrains.Annotations; namespace Abp { [DebuggerStepThrough] public static class Check { [ContractAnnotation("value:null => halt")] public static T NotNull(T value, [InvokerParameterName] [NotNull] string parameterName) { if (value == null) { throw new ArgumentNullException(parameterName); } return value; } [ContractAnnotation("value:null => halt")] public static string NotNullOrEmpty(string value, [InvokerParameterName] [NotNull] string parameterName) { if (value.IsNullOrEmpty()) { throw new ArgumentException($"{parameterName} can not be null or empty!", parameterName); } return value; } [ContractAnnotation("value:null => halt")] public static string NotNullOrWhiteSpace(string value, [InvokerParameterName] [NotNull] string parameterName) { if (value.IsNullOrWhiteSpace()) { throw new ArgumentException($"{parameterName} can not be null, empty or white space!", parameterName); } return value; } [ContractAnnotation("value:null => halt")] public static ICollection NotNullOrEmpty(ICollection value, [InvokerParameterName] [NotNull] string parameterName) { if (value.IsNullOrEmpty()) { throw new ArgumentException(parameterName + " can not be null or empty!", parameterName); } return value; } } }