I have some code I want to run until I request cancellation.
Task.Run(() =>
{
while (!token.IsCancellationRequested)
{
GetFeedbackTask();
}
}, token);
I then execute this method token.Cancel()
. This cancels the task as expected and my while loop as expected. The problem is when I try to run the Task again after I cancel the token.IsCancellationRequested
property is still true
. What sets the property back to false
? Do I need to Dispose
the token?