VB.Net Tutorial/Thread/Thread Properties

Материал из VB Эксперт
Версия от 12:56, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Get properties of current Thread

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