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


C# DateTimeOffset.GetMicroseconds方法代码示例

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


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

示例1: GetAllTimesAfter

        public IEnumerable<DateTimeOffset> GetAllTimesAfter(DateTimeOffset value)
        {
            DateTimeOffset temp = value.ToOffset(_offset);

            bool firstYear = true;
            bool firstMonth = true;
            bool firstDay = true;
            bool firstHour = true;
            bool firstMinute = true;
            bool firstSecond = true;
            bool firstMillisecond = true;
            bool firstMicrosecond = true;

            var years = _years != null ? _years.GetViewFrom(temp.Year).Values : Enumerable.Range(temp.Year, DateTimeOffset.MaxValue.Year - temp.Year + 1);

            foreach (var year in years)
            {
                firstYear &= year == value.Year;

                foreach (var month in firstYear ? _months.GetViewFrom(temp.Month).Values : _months.Values)
                {
                    firstMonth &= firstYear && month == value.Month;

                    foreach (var day in firstMonth ? _days.GetViewFrom(temp.Year, temp.Month, temp.Day).Values : _days.GetValues(year, month))
                    {
                        firstDay &= firstMonth && day == value.Day;

                        foreach (var hour in firstDay ? _hours.GetViewFrom(temp.Hour).Values : _hours.Values)
                        {
                            firstHour &= firstDay && hour == value.Hour;

                            foreach (var minute in firstHour ? _minutes.GetViewFrom(temp.Minute).Values : _minutes.Values)
                            {
                                firstMinute &= firstHour && minute == value.Minute;

                                foreach (var second in firstMinute ? _seconds.GetViewFrom(temp.Second).Values : _seconds.Values)
                                {
                                    firstSecond &= firstMinute && second == value.Second;

                                    foreach (var millisecond in firstSecond ? _milliseconds.GetViewFrom(temp.Millisecond).Values : _milliseconds.Values)
                                    {
                                        firstMillisecond &= firstSecond && millisecond == value.Millisecond;

                                        foreach (var microsecond in firstMillisecond ? _microseconds.GetViewFrom(temp.GetMicroseconds()).Values : _microseconds.Values)
                                        {
                                            firstMicrosecond &= firstMillisecond && microsecond == value.GetMicroseconds();

                                            foreach (var nanosecond in firstMicrosecond ? _nanoseconds.GetViewFrom(temp.GetNanoseconds()).Values : _nanoseconds.Values)
                                            {
                                                var next = new DateTimeOffset(year, month, day, hour, minute, second, millisecond, _offset).AddNanoseconds(microsecond * 1000 + nanosecond);
                                                if (next <= temp) { continue; }

                                                yield return next.ToOffset(value.Offset);
                                            }

                                            firstMicrosecond = false;
                                        }

                                        firstMillisecond = false;
                                    }

                                    firstSecond = false;
                                }

                                firstMinute = false;
                            }

                            firstHour = false;
                        }

                        firstDay = false;
                    }

                    firstMonth = false;
                }

                firstYear = false;
            }
        }
开发者ID:rgonek,项目名称:crongadgetry,代码行数:79,代码来源:CronExpression.cs


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