I know it sounds stupid, but I\'ve tried everything to stop a timer, but the timer won\'t stop. I\'m working on a game and i would appreciate if someone could tell me how to
With each of the timers in the .NET framework, it's possible that the timer fires just before you stop it, so you'll see the callback after you stop it.
You'll need to use something like an asynchronous callback context: use a bool
set to true
when you want the timer running, and set it to false
when you stop it. Then have your callback check your context to see if it should really run or not.