Trying to figure out whether I should use a Timer or a Stopwatch

blue BMW car facing backward on a race track

I want to create a thread that every 5 seconds it calls an list of Actions (trying to make generative music and I want a very consistent beat). My initial thought is to use a Timer(ThreadCallback, AutoResetEvent, 5000, 5000); but I want to be able to pause and resume this timer but I can’t seem to figure out a clean way to do so. I guess I could try and use Timer.Change(); but I can’t figure out how to make it change to an indefinite pause. Googling “Csharp pause Timer class” I repeatedly read to use the Stopwatch class, but as a System.Diagnostics class I don’t think I should include it in production code is that a reasonable view to have?

I would like input on the issue if anyone has familiarity with this.

Latest posts