本文整理汇总了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;
}
}