When a thread terminates, it is implemented by the thread class's Abort method, such as if an out-of-the-box execution time is too long, the user may want to terminate the thread, which is the way to use this method
Note: When a thread calls the Abort method, a Threadabortexcepion exception is thrown, and if no exception is caught, it terminates
Instance
If the thread that outputs the ">" character on the screen is executed through while, the number of cycles is calculated when the thread has not finished executing, and the thread is terminated when it reaches 5 times.
 classProgram { Public Static voidmeth () { for(inti =1; I <=4000; i++)            {                if(i% +==0) {Console.WriteLine (">"); }                Else{Console.Write (">"); }            }        }        Static voidMain (string[] args) {            //ThreadStart ts = new ThreadStart (meth);Thread th =NewThread (meth); Th.            Start (); Console.WriteLine ("thread starts to start"); inti =0;  while(Th. IsAlive)//Determine thread status{i++; Thread.Sleep (5);//thread hangs 5 seconds after execution, or "Start and stop" is displayed                if(i==5) {th.   Abort (); //terminating a threadConsole.WriteLine ("Thread Termination");        }} console.read (); }
Thread Operation termination Thread