c# - The name 'Thread' does not exist in the current context -
when put code thread.sleep(2000); gives me error:
the name 'thread' not exist in current context`.
i included namespace using system.threading;. see system.threading.thread.sleep() on msdn.
i assume portable class library or windows store/phone project targeting windows runtime not have such construct.
an alternative , recommended way use:
await task.delay(timespan.fromseconds(2));
or blocking call in case not in async context:
task.delay(timespan.fromseconds(2)).wait();
similar issue brought out in this post.
Comments
Post a Comment