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


C# DateRange.ForEachWeek方法代码示例

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


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

示例1: ForEachWeek_Full

 public void ForEachWeek_Full()
 {
     int count = 0;
     int weekCount = 2;
     DateRange[] weeks = new DateRange[weekCount];
     DateTime weekEnd = new DateTime(2005, 12, 17);
     DateTime weekStart = new DateTime(2005, 12, 4);
     DateRange range = new DateRange(weekStart, weekEnd);
     weeks[0] = new DateRange(weekStart,new DateTime(2005, 12, 10));
     weeks[1] = new DateRange(new DateTime(2005, 12,11), weekEnd);
     range.ForEachWeek(delegate(DateRange week)
                          {
                              Assert.AreEqual(weeks[count], week);
                              count++;
                          });
     Assert.AreEqual(weekCount, count);
 }
开发者ID:JackWangCUMT,项目名称:rhino-tools,代码行数:17,代码来源:DateRangeTests.cs

示例2: ForEachWeek_Partial

 public void ForEachWeek_Partial()
 {
     int count = 0;
     int weekCount = 1;
     DateRange[] weeks = new DateRange[weekCount];
     DateRange range = new DateRange(start, start);
     weeks[0] = new DateRange(start, start);
     range.ForEachWeek(delegate(DateRange week)
                          {
                              Assert.AreEqual(weeks[count], week);
                              count++;
                          });
     Assert.AreEqual(weekCount, count);
 }
开发者ID:JackWangCUMT,项目名称:rhino-tools,代码行数:14,代码来源:DateRangeTests.cs

示例3: ForEachWeek

 public void ForEachWeek()
 {
     int count = 0;
     int weekCount = 12;
     DateRange[] weeks = new DateRange[weekCount];
     DateRange range = new DateRange(start, end);
     weeks[0] = new DateRange(start, start);
     DateTime current = start.AddDays(1);
     for (int i = 1; i < weekCount-1; i++)
     {
         weeks[i] = new DateRange(current, current.AddDays(6));
         current = current.AddDays(7);
     }
     weeks[weekCount - 1] = new DateRange(current, end);
     range.ForEachWeek(delegate(DateRange week)
                          {
                               Assert.AreEqual(weeks[count], week);
                              count++;
                          });
     Assert.AreEqual(weekCount, count);
 }
开发者ID:JackWangCUMT,项目名称:rhino-tools,代码行数:21,代码来源:DateRangeTests.cs


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