Main Thread
เธรดแรกที่รันในโปรเซส เรียกว่า Main Thread สร้างขึ้นอัตโนมัติเมื่อโปรแกรม C# เริ่มทำงาน
Child Thread
เธรดที่สร้างจากคลาส Thread เรียกว่า Child Thread ของ Main Thread
ตัวอย่าง
using System;
using System.Threading;
namespace Demo {
class Program {
static void Main(string[] args) {
Thread th = Thread.CurrentThread;
th.Name = "MainThread";
Console.WriteLine("This is {0}", th.Name);
Console.ReadKey();
}
}
}
ผลลัพธ์
This is MainThread