I’ve just started with C#. I’m running an object’s function as a thread (new Thread(myFunc).Start()).
Does the thread kill itself when the function is finished or must I manually get rid of it? If I must, what is the best way to do it (I may not know when it finishes etc)?
Thanx!
Yes the thread will exit when the function returns. If it is a long-running task and you want to be sure it has finished before the program exits, you can use Thread.Join which will block the main thread until the other thread completes.