Versión imprimible       Enviar     
Evaluar y enviar comentarios
MSDN
MSDN Library
 CurrentThread (Propiedad)
Contraer todo/Expandir todo Contraer todo
Esta página es específica de
Microsoft Visual Studio 2005/.NET Framework 2.0

Hay además otras versiones disponibles para:
Thread.CurrentThread (Propiedad)
Obtiene el subproceso actualmente en ejecución.

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

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.

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 " );
}

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.

.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
© 2009 Microsoft Corporation. Reservados todos los derechos. Términos de uso | Marcas Registradas | Privacidad
Page view tracker