Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

666
Vistas
The name 'Thread' does not exist in the current context

When I put this code Thread.Sleep(2000); it gives me the error:

The name 'Thread' does not exist in the current context`.

I already included the namespace using System.Threading;. See System.Threading.Thread.Sleep() on MSDN.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

I'm guessing it's a Portable Class Library or Windows Store/Phone project targeting the Windows Runtime that doesn't have such a construct.


An alternative and recommended way would be to use:

await Task.Delay(TimeSpan.FromSeconds(2));

or for a blocking call in case it's not in an async context:

Task.Delay(TimeSpan.FromSeconds(2)).Wait();

A similar problem is also presented in this post.

over 4 years ago · Santiago Trujillo Denunciar

0

Try using the full namespace in your code:

 System.Threading.Thread.Sleep(1000);
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda