当前位置: 首页>>代码示例>>C#>>正文


C# DayOfWeek.Count方法代码示例

本文整理汇总了C#中DayOfWeek.Count方法的典型用法代码示例。如果您正苦于以下问题:C# DayOfWeek.Count方法的具体用法?C# DayOfWeek.Count怎么用?C# DayOfWeek.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DayOfWeek的用法示例。


在下文中一共展示了DayOfWeek.Count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemoveBusinessDays

        /// <summary>
        /// Remove business days on a DateTime
        /// </summary>
        /// <param name="date">Date to remove days</param>
        /// <param name="days">Days to remove</param>
        /// <param name="businessDays">Business days</param>
        /// <returns>date</returns>
        public static DateTime RemoveBusinessDays(this DateTime date, int days, DayOfWeek[] businessDays)
        {
            days = Math.Abs(days);
            if (businessDays == null || businessDays.Count() == 0)
                businessDays = BaseDateTimeExtensions.GetDefaultBusinessDays();

            var finalCount = 0;
            while (true)
            {
                if (businessDays.Contains(date.DayOfWeek))
                    finalCount++;

                date = date.AddDays(-1);

                if (days == finalCount)
                    break;
            }

            return date;
        }
开发者ID:jornfilho,项目名称:.net-Dev-Utils,代码行数:27,代码来源:Utils.cs

示例2: SetDefaultBusinessDays

 /// <summary>
 /// Set default business days list
 /// </summary>
 public static void SetDefaultBusinessDays(DayOfWeek[] businessDays)
 {
     if (businessDays != null && businessDays.Count() > 0)
         Instance.BusinessDays = businessDays;
 }
开发者ID:rene15009,项目名称:.net-Dev-Utils,代码行数:8,代码来源:BaseDateTimeExtensions.cs

示例3: EndOfBusinessMonth

        /// <summary>
        /// Get end of business month
        /// </summary>
        /// <param name="date">base date</param>
        /// <param name="businessDays">business days list</param>
        /// <returns>End of business month from date</returns>
        public static DateTime EndOfBusinessMonth(this DateTime date, DayOfWeek[] businessDays)
        {
            date = date.EndOfMonth();

            if (businessDays == null || businessDays.Count() == 0)
                businessDays = BaseDateTimeExtensions.GetDefaultBusinessDays();

            while (true)
            {
                if (businessDays.Contains(date.DayOfWeek))
                    return date;

                date = date.AddDays(-1);
            }
        }
开发者ID:jornfilho,项目名称:.net-Dev-Utils,代码行数:21,代码来源:Utils.cs


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