Hishop.Components.Validation/Validators/ValidatorArgumentsValidatorHelper.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

namespace Hishop.Components.Validation.Validators
{
    using Hishop.Components.Validation.Properties;
    using System;

    internal static class ValidatorArgumentsValidatorHelper
    {
        internal static void ValidateContainsCharacterValidator(string characterSet)
        {
            if (characterSet == null)
            {
                throw new ArgumentNullException("characterSet");
            }
        }

        internal static void ValidateDomainValidator(object domain)
        {
            if (domain == null)
            {
                throw new ArgumentNullException("domain");
            }
        }

        internal static void ValidateEnumConversionValidator(Type enumType)
        {
            if (enumType == null)
            {
                throw new ArgumentNullException("enumType");
            }
        }

        internal static void ValidateRangeValidator(IComparable lowerBound, RangeBoundaryType lowerBoundaryType, IComparable upperBound, RangeBoundaryType upperBoundaryType)
        {
            if ((lowerBoundaryType != RangeBoundaryType.Ignore) && (lowerBound == null))
            {
                throw new ArgumentNullException("lowerBound");
            }
            if ((upperBoundaryType != RangeBoundaryType.Ignore) && (upperBound == null))
            {
                throw new ArgumentNullException("upperBound");
            }
            if ((lowerBoundaryType == RangeBoundaryType.Ignore) && (upperBoundaryType == RangeBoundaryType.Ignore))
            {
                throw new ArgumentException(Resources.ExceptionCannotIgnoreBothBoundariesInRange, "lowerBound");
            }
            if (((lowerBound != null) && (upperBound != null)) && (lowerBound.GetType() != upperBound.GetType()))
            {
                throw new ArgumentException(Resources.ExceptionTypeOfBoundsMustMatch, "upperBound");
            }
        }

        internal static void ValidateRegexValidator(string pattern, string patternResourceName, Type patternResourceType)
        {
            if ((pattern == null) && ((patternResourceName == null) || (patternResourceType == null)))
            {
                throw new ArgumentNullException("pattern");
            }
            if ((pattern == null) && (patternResourceName == null))
            {
                throw new ArgumentNullException("patternResourceName");
后面还有 25 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。