I have async callback, which is passed into Timer(from System.Threading) constructor :
private async Task HandleTimerCallback(object state) { if (timer == null) return; if (asynTaskCallback != null) { await HandleAsyncTaskTimerCallback(state); } else { HandleSyncTimerCallback(state); } } And Timer :
timer = new Timer(async o => await HandleTimerCallback(o), state, CommonConstants.InfiniteTimespan, CommonConstants.InfiniteTimespan); Is there any way to omit that o param in lambda? Cause for not-async I can just pass my handler as delegate
timer = new Timer(HandleTimerCallback, state, CommonConstants.InfiniteTimespan, CommonConstants.InfiniteTimespan);
await Task.Delay(someValue)somewhere in the loop body and call your method from the loop body too.