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


C# iCalendar.GetOccurrences方法代码示例

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


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

示例1: Bug3414862

        public void Bug3414862()
        {
            IICalendar iCal = new iCalendar();
            Event evt = iCal.Create<Event>();
            RecurrencePattern rPattern = new RecurrencePattern();
            rPattern.Frequency = FrequencyType.Weekly;
            FrequencyOccurrence frequencyOccurrence = FrequencyOccurrence.First;
            rPattern.ByDay.Add(new WeekDay(DayOfWeek.Wednesday, frequencyOccurrence));

            DateTime startDateTime = new DateTime(2011, 1, 5, 13, 0, 0);
            DateTime endDateTime = new DateTime(2013, 4, 3, 13, 45, 0);
            evt.Start = new iCalDateTime(startDateTime);

            evt.Duration = new TimeSpan(0, 45, 0);
            rPattern.Until = endDateTime;
            evt.RecurrenceRules.Add(rPattern);

            DateTime thruDateTime = new DateTime(2013, 3, 6);

            IList<Occurrence> occurrences = iCal.GetOccurrences(startDateTime, thruDateTime.Date.AddDays(1).AddSeconds(-1));

            // There should be exactly 114 occurrences 
            Assert.AreEqual(114, occurrences.Count);

            // The last occurrence should be on march 6th
            Assert.AreEqual(new DateTime(2013, 3, 6), occurrences.Last().Period.StartTime.Date);
        }
开发者ID:nachocove,项目名称:DDay-iCal-Xamarin,代码行数:27,代码来源:RecurrenceTest.cs


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