using System;
using System.Threading;namespace ThreadStates
{
class ThreadState
{
static void Main()
{
Thread.CurrentThread.Abort();
Console.WriteLine("当前状态:"+Thread.CurrentThread.IsAlive);
}
}
}
using System.Threading;namespace ThreadStates
{
class ThreadState
{
static void Main()
{
Thread.CurrentThread.Abort();
Console.WriteLine("当前状态:"+Thread.CurrentThread.IsAlive);
}
}
}
把这一句放到abort的前面就行
线程已经在被你停止,你再读状态当然会报错