using System.Collections.Generic;
using System.Threading.Tasks;
public static async IAsyncEnumerable<int> CallingNetSuiteApi()
var timer = new PeriodicTimer(TimeSpan.FromSeconds(1));
await timer.WaitForNextTickAsync().ConfigureAwait(false);
Console.WriteLine($"{DateTime.Now} Retrieve {i}");
public static async IAsyncEnumerable<int> CallingNetSuiteApiNonStop()
await foreach (var i in CallingNetSuiteApi().ConfigureAwait(false)) {
public static async Task Main()
Console.WriteLine($"{DateTime.Now} Start");
await foreach (var i in CallingNetSuiteApiNonStop().ConfigureAwait(false)) {
Console.WriteLine($"{DateTime.Now} Store {i}");
Console.WriteLine($"{DateTime.Now} Wait 2s {i}");
await new PeriodicTimer(TimeSpan.FromSeconds(2)).WaitForNextTickAsync().ConfigureAwait(false);
await new PeriodicTimer(TimeSpan.FromSeconds(1)).WaitForNextTickAsync().ConfigureAwait(false);
Console.WriteLine($"{DateTime.Now} End");