I'm a newbie in C#. I have a windows service. In this service, I run a thread. I want to stop the service immediately after the thread finish. Currently, my code is like:
while(true){
if(isThreadFinished){
MyService.Stop();
break;
}
}
It work, but I feel that using while(true) like that is a stupid way. So, I want to know if there is any other way to achieve my request.