在进程内创建的第一个线程称为主线程。它先开始,最后结束。
using System; using System.Threading; public class ThreadExample { public static void Main(string[] args) { Thread t = Thread.CurrentThread; t.Name = "MainThread"; Console.WriteLine(t.Name); } }
输出:
MainThread
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)