c# - Sort of scheduler -


I need to implement something, something that could have done certain functions in my program, for example, every ten seconds In the file, write something in a log in the file. Of course, it seems to run in a background thread.

Where should I dig? I am not very familiar with multithreading. I have heard about the category of background, but I am not sure it is appropriate ..

Use the system. threading. Timer, it will run the task in a threadpile thread. This is the most effective way for this.

Here's an example, every 10 seconds:

  timer aTimer = new system. threading. Timer (My Task, Empty, 0, 10000); Static Zero My Task (Object State) {...}  

Comments

Popular posts from this blog

c# - PInvoke of NetUserAdd returns 24 -

c# - XMLDocument.Validate Error: System.InvalidOperationException : The XmlSchemaSet on the document is either null or has no schemas in it -