locked
Thread.Sleep won't appear using system.threading RRS feed

  • Question

  • I have

    using System;
    using System.Threading;

    in my Page.xaml.cs file but I can't use

    Thread.Sleep(20);

    The code auto-completion only shows "ThreadLocal" and "ThreadStaticAttribute" as options.

    I've tried creating a new blank windows phone project and I still can't get "Thread.Sleep" to work.

    What am I missing?  Thanks.

    Thursday, August 7, 2014 2:34 PM

Answers

  • Use instead:

    await Task.Delay(20);

    In .Net 4.5 work new asynchronous programming model with Async and Await.


    • Edited by Oleg Kurzov Thursday, August 7, 2014 2:46 PM
    • Marked as answer by CASchwarz Thursday, August 7, 2014 2:51 PM
    Thursday, August 7, 2014 2:46 PM

All replies

  • Use instead:

    await Task.Delay(20);

    In .Net 4.5 work new asynchronous programming model with Async and Await.


    • Edited by Oleg Kurzov Thursday, August 7, 2014 2:46 PM
    • Marked as answer by CASchwarz Thursday, August 7, 2014 2:51 PM
    Thursday, August 7, 2014 2:46 PM
  • Perfect thankyou!  And background threading it also makes it ideal for me.
    Thursday, August 7, 2014 2:52 PM