示例#1
0
        public static bool TryValidateNull(object value, [NotNull] string message, bool throwException = false)
        {
            if ((value is null) && throwException)
            {
                ExceptionThrower.ThrowInvalidValueException(message, value);
            }

            return(value is null);
        }
示例#2
0
        public static bool TryValidateNull(object value, bool throwException = false)
        {
            if ((value is null) && throwException)
            {
                ExceptionThrower.ThrowInvalidValueException(Resources.ObjectValidationFailed, value);
            }

            return(value is null);
        }
示例#3
0
        public static bool TryValidateValue(string input, bool throwException = false)
        {
            var result = string.IsNullOrEmpty(input);

            if (result is true && throwException)
            {
                ExceptionThrower.ThrowInvalidValueException(Resources.StringIsNotValid, input);
            }

            return(result);
        }
示例#4
0
        public static bool TryValidateValue <TValue>(
            TValue input,
            bool condition,
            string message      = "",
            bool throwException = false)
        {
            if (condition is false && throwException)
            {
                message = CreateExceptionMessage(message, Resources.InvalidValue);
                ExceptionThrower.ThrowInvalidValueException <object>(message, input);
            }

            return(condition);
        }