本文整理汇总了C#中System.Globalization.Calendar.AddMinutes方法的典型用法代码示例。如果您正苦于以下问题:C# Calendar.AddMinutes方法的具体用法?C# Calendar.AddMinutes怎么用?C# Calendar.AddMinutes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Globalization.Calendar
的用法示例。
在下文中一共展示了Calendar.AddMinutes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOccurrences
private static IEnumerable<DateTime> GetOccurrences(DateInterval interval, DatePeriod period, Calendar calendar, DateTime start, DateTime end, bool skipWeekends = true)
{
var difference = DateSpan.GetDifference(interval, start, end)/period.Quantifier;
if (start.Kind == DateTimeKind.Utc)
{
start = start.ToLocalTime();
}
for (var i = 0; i < difference; i++)
{
switch (period.Frequency)
{
case DatePeriodFrequency.Seconds:
var seconds = calendar.AddSeconds(start, period.Quantifier * i);
yield return DeferOccurrenceFallingOnWeekend(calendar, seconds, skipWeekends);
break;
case DatePeriodFrequency.Minutes:
var minutes = calendar.AddMinutes(start, period.Quantifier * i);
yield return DeferOccurrenceFallingOnWeekend(calendar, minutes, skipWeekends);
break;
case DatePeriodFrequency.Hours:
var hours = calendar.AddHours(start, period.Quantifier * i);
yield return DeferOccurrenceFallingOnWeekend(calendar, hours, skipWeekends);
break;
case DatePeriodFrequency.Days:
var days = calendar.AddDays(start, period.Quantifier*i);
yield return DeferOccurrenceFallingOnWeekend(calendar, days, skipWeekends);
break;
case DatePeriodFrequency.Weeks:
var weeks = calendar.AddWeeks(start, period.Quantifier*i);
yield return DeferOccurrenceFallingOnWeekend(calendar, weeks, skipWeekends);
break;
case DatePeriodFrequency.Months:
var months = calendar.AddMonths(start, period.Quantifier*i);
yield return DeferOccurrenceFallingOnWeekend(calendar, months, skipWeekends);
break;
case DatePeriodFrequency.Years:
var years = calendar.AddYears(start, period.Quantifier*i);
yield return DeferOccurrenceFallingOnWeekend(calendar, years, skipWeekends);
break;
default:
throw new ArgumentException("Frequency");
}
}
}