title: How to make Task awaitable
body: <p>Yesterday I started playing with Microsoft CTP async library, and nowhere I could not find the proper implementation of the awaitable Task. I know that it must have implementation like this?:</p>
  
  <pre><code>public struct SampleAwaiter&lt;T&gt;
  {
      private readonly Task&lt;T&gt; task;
      public SampleAwaiter(Task&lt;T&gt; task) { this.task = task; }
      public bool IsCompleted { get { return task.IsCompleted; } }
      public void OnCompleted(Action continuation) { TaskEx.Run(continuation); }
      public T GetResult() { return task.Result; }
  }
  </code></pre>
  
  <p>But how would I now implement a task that would, let's say, wait 5 seconds, and the return some string, for example "Hello World"?</p>
  
  <p>One way is to use Task directly like so:</p>
  
  <pre><code>Task&lt;string&gt; task = TaskEx.Run(
              () =&gt;
                  {
                      Thread.Sleep(5000);
                      return "Hello World";
                  });
  
          string str = await task;
  </code></pre>
  
  <p>But how would I do that with the awaitable implementation? Or did I just misunderstood everything?</p>
  
  <p>Thanks for any information/help :)</p>