• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# RangeBoundaryType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中RangeBoundaryType的典型用法代码示例。如果您正苦于以下问题:C# RangeBoundaryType类的具体用法?C# RangeBoundaryType怎么用?C# RangeBoundaryType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RangeBoundaryType类属于命名空间,在下文中一共展示了RangeBoundaryType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ValidateRelativeDatimeValidator

 internal static void ValidateRelativeDatimeValidator(int lowerBound, DateTimeUnit lowerUnit, RangeBoundaryType lowerBoundType, int upperBound, DateTimeUnit upperUnit, RangeBoundaryType upperBoundType)
 {
     if ((((lowerBound != 0) && (lowerUnit == DateTimeUnit.None)) && (lowerBoundType != RangeBoundaryType.Ignore)) || (((upperBound != 0) && (upperUnit == DateTimeUnit.None)) && (upperBoundType != RangeBoundaryType.Ignore)))
     {
         throw new ArgumentException(Resources.RelativeDateTimeValidatorNotValidDateTimeUnit);
     }
 }
开发者ID:davinx,项目名称:himedi,代码行数:7,代码来源:ValidatorArgumentsValidatorHelper.cs


示例2: DateTimeRangeValidatorAttribute

 /// <summary>
 /// Initializes a new instance with lower and upper bounds, and bound types.
 /// </summary>
 /// <param name="lowerBound">An ISO8601 formatted string representing the lower bound, like "2006-01-20T00:00:00".</param>
 /// <param name="lowerBoundType">The bound type for the lower bound.</param>
 /// <param name="upperBound">An ISO8601 formatted string representing the upper bound, like "2006-01-20T00:00:00".</param>
 /// <param name="upperBoundType">The bound type for the upper bound.</param>
 public DateTimeRangeValidatorAttribute(
     string lowerBound,
     RangeBoundaryType lowerBoundType,
     string upperBound,
     RangeBoundaryType upperBoundType)
     : this(lowerBound, ConvertToISO8601Date(lowerBound, "lowerBound"), lowerBoundType, upperBound, ConvertToISO8601Date(upperBound, "upperBound"), upperBoundType)
 { }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:14,代码来源:DateTimeRangeValidatorAttribute.cs


示例3: DateTimeRangeValidatorAttribute

 public DateTimeRangeValidatorAttribute(DateTime lowerBound, RangeBoundaryType lowerBoundType, DateTime upperBound, RangeBoundaryType upperBoundType)
 {
     this.lowerBound = lowerBound;
     this.lowerBoundType = lowerBoundType;
     this.upperBound = upperBound;
     this.upperBoundType = upperBoundType;
 }
开发者ID:davinx,项目名称:himedi,代码行数:7,代码来源:DateTimeRangeValidatorAttribute.cs


示例4: StringLengthValidatorAttribute

 public StringLengthValidatorAttribute(int lowerBound, RangeBoundaryType lowerBoundType, int upperBound, RangeBoundaryType upperBoundType)
 {
     this.lowerBound = lowerBound;
     this.lowerBoundType = lowerBoundType;
     this.upperBound = upperBound;
     this.upperBoundType = upperBoundType;
 }
开发者ID:davinx,项目名称:himedi,代码行数:7,代码来源:StringLengthValidatorAttribute.cs


示例5: RangeValidatorAttribute

 RangeValidatorAttribute(IComparable lowerBound, RangeBoundaryType lowerBoundType, IComparable upperBound, RangeBoundaryType upperBoundType)
 {
     ValidatorArgumentsValidatorHelper.ValidateRangeValidator(lowerBound, lowerBoundType, upperBound, upperBoundType);
     this.lowerBound = lowerBound;
     this.lowerBoundType = lowerBoundType;
     this.upperBound = upperBound;
     this.upperBoundType = upperBoundType;
 }
开发者ID:davinx,项目名称:himedi,代码行数:8,代码来源:RangeValidatorAttribute.cs


示例6: NumericRangeValidator

        public NumericRangeValidator(NameValueCollection attributes)
            : base(null, null)
        {
            lowerBoundType = (RangeBoundaryType)Enum.Parse(typeof(RangeBoundaryType), attributes.Get("lowerBoundType"));
            upperBoundType = (RangeBoundaryType)Enum.Parse(typeof(RangeBoundaryType), attributes.Get("upperBoundType"));

            int lower;
            if (int.TryParse(attributes.Get("lowerBound"), out lower))
            {
                lowerBound = lower;
            }
            else
            {
                lowerBound = int.MinValue;
            }

            int upper;
            if (int.TryParse(attributes.Get("upperBound"), out upper))
            {
                upperBound = upper;
            }
            else
            {
                upperBound = int.MaxValue;
            }

            int max;
            if (int.TryParse(attributes.Get("maxLength"), out max))
            {
                maxLength = max;
            }
            else
            {
                maxLength = int.MaxValue;
            }

            if (attributes.Get("mandatoryMessageTemplate") != null)
            {
                this.mandatoryMessageTemplate = attributes.Get("mandatoryMessageTemplate").ToString();
            }

            if (attributes.Get("invalidMessageTemplate") != null)
            {
                this.invalidMessageTemplate = attributes.Get("invalidMessageTemplate").ToString();
            }

            if (attributes.Get("rangeMessageTemplate") != null)
            {
                this.rangeMessageTemplate = attributes.Get("rangeMessageTemplate").ToString();
            }

            if (attributes.Get("maxLengthMessageTemplate") != null)
            {
                this.maxLengthMessageTemplate = attributes.Get("maxLengthMessageTemplate").ToString();
            }
        }
开发者ID:rentianhua,项目名称:AgileMVC,代码行数:56,代码来源:NumericRangeValidator.cs


示例7: RelativeDateTimeValidatorAttribute

 public RelativeDateTimeValidatorAttribute(int lowerBound, DateTimeUnit lowerUnit, RangeBoundaryType lowerBoundType, int upperBound, DateTimeUnit upperUnit, RangeBoundaryType upperBoundType)
 {
     ValidatorArgumentsValidatorHelper.ValidateRelativeDatimeValidator(lowerBound, lowerUnit, lowerBoundType, upperBound, upperUnit, upperBoundType);
     this.lowerBound = lowerBound;
     this.lowerUnit = lowerUnit;
     this.lowerBoundType = lowerBoundType;
     this.upperBound = upperBound;
     this.upperUnit = upperUnit;
     this.upperBoundType = upperBoundType;
 }
开发者ID:davinx,项目名称:himedi,代码行数:10,代码来源:RelativeDateTimeValidatorAttribute.cs


示例8: ValidRelativeMonthYear

        internal static bool ValidRelativeMonthYear(MonthYear input,
                                                    int lowerBound, MonthYearUnit lowerUnit, RangeBoundaryType lowerBoundType,
                                                    int upperBound, MonthYearUnit upperUnit, RangeBoundaryType upperBoundType)
        {
            DateTime now = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            DateTime lowerDate = DateTime.MinValue;
            DateTime upperDate = DateTime.MaxValue;
            DateTime inputDate = new DateTime(input.Year, input.Month, 1);

            switch (lowerUnit)
            {
                case MonthYearUnit.Month:
                    lowerDate = now.AddMonths(lowerBound * -1);
                    break;
                case MonthYearUnit.Year:
                    lowerDate = now.AddYears(lowerBound * -1);
                    break;
            }
            switch (upperUnit)
            {
                case MonthYearUnit.Month:
                    upperDate = now.AddMonths(upperBound);
                    break;
                case MonthYearUnit.Year:
                    upperDate = now.AddYears(upperBound);
                    break;
            }

            //default the bound check to true - if lowerBoundType is Ignore, no test will be performed.
            bool lowerBoundOk = true;
            if (lowerBoundType == RangeBoundaryType.Inclusive)
            {
                lowerBoundOk = inputDate.CompareTo(lowerDate) >= 0;
            }
            else if (lowerBoundType == RangeBoundaryType.Exclusive)
            {
                lowerBoundOk = inputDate.CompareTo(lowerDate) > 0;
            }

            //default the bound check to true - if upperBoundType is Ignore, no test will be performed.
            bool upperBoundOk = true;
            if (upperBoundType == RangeBoundaryType.Inclusive)
            {
                upperBoundOk = inputDate.CompareTo(upperDate) <= 0;
            }
            else if (upperBoundType == RangeBoundaryType.Exclusive)
            {
                upperBoundOk = inputDate.CompareTo(upperDate) < 0;
            }

            return lowerBoundOk && upperBoundOk;
        }
开发者ID:GrahamClark,项目名称:TestConsoleApp,代码行数:52,代码来源:Runner.cs


示例9: NumericRangeValidatorAttribute

 public NumericRangeValidatorAttribute(int lowerBound, RangeBoundaryType lowerBoundType,
     int upperBound, RangeBoundaryType upperBoundType, int maxLength,
     string mandatoryMessageTemplate, string invalidMessageTemplate,
     string rangeMessageTemplate, string maxLengthMessageTemplate)
 {
     this.lowerBound = lowerBound;
     this.lowerBoundType = lowerBoundType;
     this.upperBound = upperBound;
     this.upperBoundType = upperBoundType;
     this.maxLength = maxLength;
     this.mandatoryMessageTemplate = mandatoryMessageTemplate;
     this.invalidMessageTemplate = invalidMessageTemplate;
     this.rangeMessageTemplate = rangeMessageTemplate;
     this.maxLengthMessageTemplate = maxLengthMessageTemplate;
 }
开发者ID:rentianhua,项目名称:AgileMVC,代码行数:15,代码来源:NumericRangeValidatorAttribute.cs


示例10: DateTimeRangeValidatorOperation

        public DateTimeRangeValidatorOperation(
            string keyToValidate,
            string resultKey,
            DateTime lowerBound,
            RangeBoundaryType lowerBoundary,
            DateTime upperBound,
            RangeBoundaryType upperBoundary,

            bool negated) : base(keyToValidate, resultKey) {

            Validator = new DateTimeRangeValidator(
                lowerBound,
                lowerBoundary,
                upperBound,
                upperBoundary,
                negated
            ) { Tag = keyToValidate };
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:18,代码来源:DateTimeRangeValidatorOperation.cs


示例11: StringLengthValidatorOperation

        public StringLengthValidatorOperation(
            string keyToValidate,
            string resultKey,
            int lowerBound,
            RangeBoundaryType lowerBoundaryType,
            int upperBound,
            RangeBoundaryType upperBoundaryType,
            bool negated)
            : base(keyToValidate, resultKey) {

            Validator = new StringLengthValidator(
                lowerBound,
                lowerBoundaryType,
                upperBound,
                upperBoundaryType,
                string.Empty,
                negated
                );
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:19,代码来源:StringLengthValidatorOperation.cs


示例12: ValidateRangeValidator

 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");
     }
 }
开发者ID:davinx,项目名称:himedi,代码行数:19,代码来源:ValidatorArgumentsValidatorHelper.cs


示例13: RangeValidatorOperation

        public RangeValidatorOperation(
            string keyToValidate,
            string resultKey,
            IComparable lowerBound,
            RangeBoundaryType lowerBoundary,
            IComparable upperBound,
            RangeBoundaryType upperBoundary,
            bool negated)
            : base(keyToValidate, resultKey) {

            Validator = new RangeValidator(
                lowerBound,
                lowerBoundary,
                upperBound,
                upperBoundary,
                string.Empty,
                negated
                ) { Tag = keyToValidate };

            }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:20,代码来源:RangeValidatorOperation.cs


示例14: RelativeDateTimeValidatorOperation

        public RelativeDateTimeValidatorOperation(
            string keyToValidate,
            string resultKey,
            int lowerBound,
            DateTimeUnit lowerUnit,
            RangeBoundaryType lowerBoundaryType,
            int upperBound,
            DateTimeUnit upperUnit,
            RangeBoundaryType upperBoundaryType,
            bool negated)
            : base(keyToValidate, resultKey) {

            Validator = new RelativeDateTimeValidator(
                lowerBound,
                lowerUnit,
                lowerBoundaryType,
                upperBound,
                upperUnit,
                upperBoundaryType,
                string.Empty,
                negated
            ) { Tag = keyToValidate };
        }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:23,代码来源:RelativeDateTimeValidatorOperation.cs


示例15: StringDateTimeRangeValidator

 /// <summary>
 /// Initializes a new instance of the  <see cref="StringDateTimeRangeValidator"/>
 /// class with fully specified bound constraints and a message template.
 /// </summary>
 /// <param name="lowerBound">The lower bound.</param>
 /// <param name="lowerBoundType">The indication of how to perform the lower bound check.</param>
 /// <param name="upperBound">The upper bound.</param>
 /// <param name="upperBoundType">The indication of how to perform the upper bound check.</param>
 /// <param name="messageTemplate">The message template to use when logging results.</param>
 /// <param name="negated">True if the validator must negate the result of the validation.</param>
 public StringDateTimeRangeValidator(DateTime lowerBound, RangeBoundaryType lowerBoundType, DateTime upperBound, RangeBoundaryType upperBoundType, string messageTemplate, bool negated)
     : base(lowerBound, lowerBoundType, upperBound, upperBoundType, messageTemplate, negated)
 {
 }
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:14,代码来源:StringDateTimeRangeValidator.cs


示例16: RelativeDateTimeValidatorAttribute

		/// <summary>
		/// <para>Initializes a new instance of the <see cref="RelativeDateTimeValidatorAttribute"/>.</para>
		/// </summary>
		/// <param name="upperBound">The upper bound</param>
		/// <param name="upperUnit">The upper bound unit of time.</param>
		/// <param name="upperBoundType">The indication of how to perform the upper bound check.</param>
		public RelativeDateTimeValidatorAttribute(int upperBound, DateTimeUnit upperUnit, RangeBoundaryType upperBoundType)
			: this(0, DateTimeUnit.None, RangeBoundaryType.Ignore, upperBound, upperUnit, upperBoundType)
		{ }
开发者ID:modulexcite,项目名称:Transformalize,代码行数:9,代码来源:RelativeDateTimeValidatorAttribute.cs


示例17: AssertRangeAttribute

 /// <summary>
 /// Initialzie a new instance of the <see cref="AssertRangeAttribute"/> class with an <see cref="Single"/> lower and upper bounds.
 /// </summary>
 /// <param name="lowerBound">
 /// The lower bound of the range.
 /// </param>
 /// <param name="lowerBoundType">
 /// One of the <see cref="RangeBoundaryType"/> values.
 /// </param>
 /// <param name="upperBound">
 /// The lower bound of the range.
 /// </param>
 /// <param name="upperBoundType">
 /// One of the <see cref="RangeBoundaryType"/> values.
 /// </param>
 public AssertRangeAttribute(float lowerBound, RangeBoundaryType lowerBoundType, float upperBound, RangeBoundaryType upperBoundType)
     : this((IComparable)lowerBound, lowerBoundType, (IComparable)upperBound, upperBoundType)
 {
 }
开发者ID:bnantz,项目名称:NCS-V2-0,代码行数:19,代码来源:AssertRangeAttribute.cs


示例18: DenyRangeAttribute

 /// <summary>
 /// Initialize a new instance of the <see cref="AssertRangeAttribute"/> class with an <see cref="Double"/> lower and upper bounds.
 /// </summary>
 /// <param name="lowerBound">
 /// The lower bound of the range.
 /// </param>
 /// <param name="lowerBoundType">
 /// One of the <see cref="RangeBoundaryType"/> values.
 /// </param>
 /// <param name="upperBound">
 /// The lower bound of the range.
 /// </param>
 /// <param name="upperBoundType">
 /// One of the <see cref="RangeBoundaryType"/> values.
 /// </param>
 public DenyRangeAttribute(double lowerBound, RangeBoundaryType lowerBoundType, double upperBound, RangeBoundaryType upperBoundType) : base((IComparable)lowerBound, lowerBoundType, (IComparable)upperBound, upperBoundType)
 {
 }
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:18,代码来源:DenyRangeAttribute.cs


示例19: RangeValidatorAttribute

 private RangeValidatorAttribute(IComparable lowerBound, RangeBoundaryType lowerBoundType,
     IComparable upperBound, RangeBoundaryType upperBoundType)
     : this(null, lowerBound, lowerBound, lowerBoundType, upperBound, upperBound, upperBoundType)
 { }
开发者ID:reckcn,项目名称:CSharp,代码行数:4,代码来源:RangeValidatorAttribute.cs


示例20: AssertRangeAttribute

 /// <summary>
 /// <para>Initialzie a new instance of the <see cref="AssertRangeAttribute"/> class with an <see cref="IComparable"/> lower and upper bounds.</para>
 /// </summary>
 /// <param name="lowerBound">
 /// <para>The lower bound of the range.</para>
 /// </param>
 /// <param name="lowerBoundType">
 /// <para>One of the <see cref="RangeBoundaryType"/> values.</para>
 /// </param>
 /// <param name="upperBound">
 /// <para>The lower bound of the range.</para>
 /// </param>
 /// <param name="upperBoundType">
 /// <para>One of the <see cref="RangeBoundaryType"/> values.</para>
 /// </param>
 protected AssertRangeAttribute(IComparable lowerBound, RangeBoundaryType lowerBoundType, IComparable upperBound, RangeBoundaryType upperBoundType)
 {
     if (lowerBound.CompareTo(upperBound) > 0)
     {
         throw new ArgumentOutOfRangeException("lowerBound", SR.ExceptionLowerBoundOutOfRange(lowerBound.ToString(), upperBound.ToString()));
     }
     this.lowerBound = lowerBound;
     this.lowerBoundType = lowerBoundType;
     this.upperBound = upperBound;
     this.upperBoundType = upperBoundType;
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:26,代码来源:AssertRangeAttribute.cs



注:本文中的RangeBoundaryType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# RangeCoder类代码示例发布时间:2022-05-24
下一篇:
C# Range类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap