Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

664
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

0

Try using the full namespace in your code:

 System.Threading.Thread.Sleep(1000);
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda