Freigeben über


Thread.CurrentThread-Eigenschaft

Ruft den derzeit ausgeführten Thread ab.

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Shared ReadOnly Property CurrentThread As Thread
'Usage
Dim value As Thread

value = Thread.CurrentThread
public static Thread CurrentThread { get; }
public:
static property Thread^ CurrentThread {
    Thread^ get ();
}
/** @property */
public static Thread get_CurrentThread ()
public static function get CurrentThread () : Thread

Eigenschaftenwert

Ein Thread, der den derzeit ausgeführten Thread darstellt.

Beispiel

Dieses Codebeispiel ist Teil eines umfangreicheren Beispiels für die IsThreadPoolThread-Eigenschaft.

Shared Sub ThreadMethod()
    Console.WriteLine("ThreadOne, executing ThreadMethod, " & _
        "is from the thread pool? {0}", _
        Thread.CurrentThread.IsThreadPoolThread)
End Sub
static void ThreadMethod()
{
    Console.WriteLine("ThreadOne, executing ThreadMethod, " +
        "is {0}from the thread pool.", 
        Thread.CurrentThread.IsThreadPoolThread ? "" : "not ");
}
static void ThreadMethod()
{
   Console::WriteLine( "ThreadOne, executing ThreadMethod, "
   "is {0}from the thread pool.", Thread::CurrentThread->IsThreadPoolThread ? (String^)"" : "not " );
}

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

Thread-Klasse
Thread-Member
System.Threading-Namespace