Sunday, 3 December 2017

C# Program to Find the Current Context id of the Thread


Code:

using System;
using System.Threading;

namespace threading
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("**********Current Thread Informations***************n");
            Thread t = Thread.CurrentThread;
            t.Name = "Primary_Thread";

            Console.WriteLine("Thread Name: {0}", t.Name);
            Console.WriteLine("Thread Status: {0}", t.IsAlive);
            Console.WriteLine("Priority: {0}", t.Priority);

            Console.ReadKey();
        }

    }
}


Output:

Thread Name: PrimaryThread
Thread Status: True
Context ID: 0


More C# Programs:





















100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...