Gets the currently running thread.
Assembly: mscorlib (in mscorlib.dll)
Syntax
A Thread that is the representation of the currently running thread.
Public Shared ReadOnly Property CurrentThread As [%$TOPIC/7y89f51w_en-us_VS_110_1_0_0_0_0%]
public static [%$TOPIC/7y89f51w_en-us_VS_110_1_0_1_0_0%] CurrentThread { get; }
public:
static property [%$TOPIC/7y89f51w_en-us_VS_110_1_0_2_0_0%]^ CurrentThread {
[%$TOPIC/7y89f51w_en-us_VS_110_1_0_2_0_1%]^ get ();
}
static member CurrentThread : [%$TOPIC/7y89f51w_en-us_VS_110_1_0_3_0_0%] with get
Property Value
Type: System.ThreadingThreadA Thread that is the representation of the currently running thread.
Examples
This code example is part of a larger example provided for the IsThreadPoolThread property.
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 " );
}
Platforms
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.