create a static Timer object and set its interval to 1000 milliseconds (1 second). We also hook up an event handler to the Elapsed event of the timer. Finally, we start the timer and wait for user input to exit the program.
The OnTimerElapsed method is called every second, and in this example, we simply output the string "Tick" to the console. You can replace this with your own code to perform whatever task you need to execute on a timer.