您现在的位置是:首页
>
理解方法是什么意思 理解.NET中Thread.Sleep()方法(C#)
理解.NET中Thread.Slee 方法 C# u i g Sy tem u i g Sy tem Threadi g ame ace ThreadTe t { u lic cla
理解.NET中Thread.Sleep()方法(C#)

using System
using System Threading
namespace ThreadTest
{
public class A { public static void B()
{ while (true)
{ Console WriteLine( A B is running in its own thread ) }
public class C { public static void Main()
{ Thread t = new Thread(new ThreadStart(A B)) t Start() Thread Sleep( ) t Abort() t Join() Console WriteLine( A B has finished ) Console ReadLine() }
}
运行后显示若干行 A B is running in its own thread 和一行 A B has finished
若取消程序中的 Thread Sleep( ) 句 则运行后只显示 A B has finished
lishixinzhi/Article/program/net/201311/13247 很赞哦! (1058)