C#-এ কারেন্ট থ্রেডের নাম দেখাতে Name প্রপার্টি ব্যবহার করুন।
প্রথমে CurrentThread প্রপার্টি ব্যবহার করুন:
Thread thread = Thread.CurrentThread;
এখন thread.Name প্রপার্টি ব্যবহার করে নাম দেখান:
thread.Name
সম্পূর্ণ উদাহরণ
using System;
using System.Threading;
namespace Demo {
class MyClass {
static void Main(string[] args) {
Thread thread = Thread.CurrentThread;
thread.Name = "My Thread";
Console.WriteLine("Thread Name = {0}", thread.Name);
Console.ReadKey();
}
}
}
আউটপুট
Thread Name = My Thread