Thread.CurrentThread (Propiedad)
Obtiene el subproceso actualmente en ejecución.

Espacio de nombres: System.Threading
Ensamblado: mscorlib (en mscorlib.dll)

Sintaxis

Visual Basic (Declaración)
Public Shared ReadOnly Property CurrentThread As Thread
Visual Basic (Uso)
Dim value As Thread

value = Thread.CurrentThread
C#
public static Thread CurrentThread { get; }
C++
public:
static property Thread^ CurrentThread {
    Thread^ get ();
}
J#
/** @property */
public static Thread get_CurrentThread ()
JScript
public static function get CurrentThread () : Thread
XAML
No aplicable.

Valor de propiedad

Thread que representa el subproceso actualmente en ejecución.
Ejemplo

Este ejemplo de código forma parte de un ejemplo más extenso referente a la propiedad IsThreadPoolThread.

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

Plataformas

Windows 98, Windows 2000 Service Pack 4, Windows CE, Windows Millennium, Windows Mobile para Pocket PC, Windows Mobile para Smartphone, Windows Server 2003, Windows XP Media Center, Windows XP Professional x64, Windows XP SP2, Windows XP Starter

Microsoft .NET Framework 3.0 es compatible con Windows Vista, Microsoft Windows XP SP2 y Windows Server 2003 SP1.

Información de versión

.NET Framework

Compatible con: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Compatible con: 2.0, 1.0

XNA Framework

Compatible con: 1.0
Vea también

Page view tracker