Timer in C#
-
Dear All, I would like the time the execution time for a script. But I did not get any idea for using timer. Any Example for counting the time of running time in a simple way? Thanks!:)
-
Dear All, I would like the time the execution time for a script. But I did not get any idea for using timer. Any Example for counting the time of running time in a simple way? Thanks!:)
To time something, grab DateTime.Now before and after the operation
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Dear All, I would like the time the execution time for a script. But I did not get any idea for using timer. Any Example for counting the time of running time in a simple way? Thanks!:)
Hi there . There is an another way to do it . Try to use Thread in Threading namespace . Something like following code :
private void StartThread() { Thread thd1 = new Thread(new ThreadStart(Your_Function()); thd1.Start(); // After start thread , your function will be execute on per second. // You can set your thread start time . } private void Your_Function() { // Do something ... }
Important : If your function get any parameter Use ParameterizedThreadStart delegate instead of ThreadStart DMASTER -
Hi there . There is an another way to do it . Try to use Thread in Threading namespace . Something like following code :
private void StartThread() { Thread thd1 = new Thread(new ThreadStart(Your_Function()); thd1.Start(); // After start thread , your function will be execute on per second. // You can set your thread start time . } private void Your_Function() { // Do something ... }
Important : If your function get any parameter Use ParameterizedThreadStart delegate instead of ThreadStart DMASTER:confused: where is the timing information ?
Developer611 wrote:
your function will be execute on per second
what is the meaning of this ? the new thread will start immediately and execute the method once...
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google