Table of Contents

Forever

Forever returns an infinite stream of Zero

var count = 0;
// Forever be used as a looping construct
foreach (Duration duration in Schedule.Forever)
{
    Assert.True(duration == Duration.Zero);
    count++;
    if (count == 10)
    {
        break;
    }
}

It can also be converted to IEnumerable<T> of Duration


Schedule forever = Schedule.Forever;
Schedule result = forever.Take(10);

Assert.False(forever.CanCount);
Assert.Null(forever.Count);

Assert.Contains(result, x => x == Duration.Zero);