public async void TaskDelayTest(CancellationToken token) { try { while (LoopCheck) { foreach (string word in WordsOfFile) { WordToShow = word; await Task.Delay(time, token); } } } catch (Exception ex) { TaskCanceledException TaskException = new TaskCanceledException("Word Stream Canceled", ex.InnerException); throw ex.InnerException; } }This is my code. And I want to call this function in another cope (for example in a button_click event). TaskDelayTest() need overload. O enter the overload
Task.Delay(CancellationToken token)
then it says System.Threading.CancellationToken' is a 'type' but is used like a 'variable'. But what it wants in Intellisense is that. So I couldn't figur out how to call this function.