AwaiterResultable.cs 482 B

123456789101112131415161718
  1. namespace XGame.Framework.Asyncs
  2. {
  3. public class AwaiterResultable<TResult> : Awaiter, IAsyncResultable<TResult>
  4. {
  5. TResult _Result;
  6. public new TResult GetResult()
  7. {
  8. return _Result;
  9. }
  10. public override void Completed(IAsync result)
  11. {
  12. if (result is IAsyncResultable<TResult>)
  13. _Result = (result as IAsyncResultable<TResult>).GetResult();
  14. base.Completed(result);
  15. }
  16. }
  17. }