How to crate a timer on c#? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to crate a timer on c#?

please explain me please

12th Apr 2018, 4:42 AM
Sai Venkat
Sai Venkat - avatar
3 Answers
+ 2
to create a timer you have to do something like this make some function timer () which is include the functionality of timer time in seconds minute and hour or in mili seconds too as you want then other functions starttimer() to start the time of timer halt timer() to stop the time of timer record time () to store the time of timer and add their functionality as you want to use as accordance to your project to code that make some decisions making and conditionals statement like if-else switch and etc.
12th Apr 2018, 6:28 AM
MsJ
MsJ - avatar
+ 1
could you please create a code for that
12th Apr 2018, 8:06 AM
Sai Venkat
Sai Venkat - avatar
+ 1
There are mainly two timer classes in C#, one from the System.Threading namespace and the other from the System.Timers namespace. The suggested-to-use one is the latter. Here's a little implementation of it from a recent code I made. https://code.sololearn.com/cHm1FFSWwORd/?ref=app
24th Apr 2018, 5:49 PM
Mante
Mante - avatar