private async Task SendWithDelay(int delay, Action action) { await Task.Delay(delay); action(); } I use this function to change the value of the flag. That is, I have a variable that accepts true or false. And you need to change the value after a while. Is this method a priority? I do not use a timer, because this function is used very often.