Get properties of current Thread : Thread Properties « Thread « VB.Net Tutorial






Imports System.Threading

Module Module1

    Sub Main()
        Dim objThread As Thread

        objThread = Thread.CurrentThread

        With objThread
            Console.WriteLine("Apartment State: {0}", .ApartmentState)
            Console.WriteLine("Current Context: {0}", .CurrentContext)
            Console.WriteLine("Current Culture: {0}", .CurrentCulture)
            Console.WriteLine("Current Principal: {0}", .CurrentPrincipal)
            Console.WriteLine("Current Thread: {0}", .CurrentThread)
            Console.WriteLine("Current UI Culture: {0}", .CurrentUICulture)
            Console.WriteLine("Is Alive: {0}", .IsAlive)
            Console.WriteLine("Is Background: {0}", .IsBackground)
            Console.WriteLine("Is Thread Pool Thread: {0}", .IsThreadPoolThread)
            Console.WriteLine("Name: {0}", .Name)
            Console.WriteLine("Priority: {0}", .Priority)
            Console.WriteLine("Thread State: {0}", .ThreadState)
        End With
    End Sub
End Module
Apartment State: STA
Current Context: ContextID: 0
Current Culture: en-CA
Current Principal: System.Security.Principal.GenericPrincipal
Current Thread: System.Threading.Thread
Current UI Culture: en-US
Is Alive: True
Is Background: False
Is Thread Pool Thread: False
Name:
Priority: Normal
Thread State: Running








23.5.Thread Properties
23.5.1.Get properties of current Thread